[PATCH] Fix VN forwprop

Richard Guenther rguenther@suse.de
Thu Jul 8 14:56:00 GMT 2010


Micha noticed that I used the wrong stmt check which disables
POINTER_PLUS_EXPR handling (which was also broken).  Fixed like
the following.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2010-07-08  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-sccvn.c (vn_reference_maybe_forwprop_address): Fix
	stmt check for POINTER_PLUS_EXPRs, fix the pointer assignment.

Index: gcc/tree-ssa-sccvn.c
===================================================================
*** gcc/tree-ssa-sccvn.c	(revision 161949)
--- gcc/tree-ssa-sccvn.c	(working copy)
*************** vn_reference_maybe_forwprop_address (VEC
*** 986,992 ****
    double_int off;
  
    def_stmt = SSA_NAME_DEF_STMT (op->op0);
!   if (!gimple_assign_single_p (def_stmt))
      return;
  
    code = gimple_assign_rhs_code (def_stmt);
--- 986,992 ----
    double_int off;
  
    def_stmt = SSA_NAME_DEF_STMT (op->op0);
!   if (!is_gimple_assign (def_stmt))
      return;
  
    code = gimple_assign_rhs_code (def_stmt);
*************** vn_reference_maybe_forwprop_address (VEC
*** 1026,1032 ****
  	return;
  
        off = double_int_add (off, tree_to_double_int (ptroff));
!       op->op0 = TREE_OPERAND (ptr, 0);
      }
  
    mem_op->op0 = double_int_to_tree (TREE_TYPE (mem_op->op0), off);
--- 1026,1032 ----
  	return;
  
        off = double_int_add (off, tree_to_double_int (ptroff));
!       op->op0 = ptr;
      }
  
    mem_op->op0 = double_int_to_tree (TREE_TYPE (mem_op->op0), off);



More information about the Gcc-patches mailing list