[tree-ssa-branch] Make SSA CCP functional [patch]

Diego Novillo dnovillo@redhat.com
Fri Aug 9 22:41:00 GMT 2002


On Fri, 2002-08-09 at 20:11, Jason Merrill wrote:
> On Wed, 7 Aug 2002 14:08:47 -0400, Diego Novillo <dnovillo@redhat.com> wrote:
> 
> > 20020807-misc.diff: Unshares references to compound expression
> >     before simplification.
> 
> Hmm, this seems to break gcc.c-torture/execute/920428-1.c, since now we
> evaluate the SAVE_EXPR twice.  What was this for?
> 
Sorry about that.  I goofed the call to walk_tree.  This was for
20020215-1.c:

	T.2 = s.i2;
	s.i2 = T.2 + 1;

It turns out that 's' is a constant value and the RHS of the first
assignment is shared with the LHS of the second.  But, the call to
walk_tree that I had added was using copy_tree_r, it should use
mostly_copy_tree_r.  I have other changes in my local tree, but this is
the patch that you need to fix this regression:

Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.9
diff -d -u -p -r1.1.4.9 c-simplify.c
--- c-simplify.c        7 Aug 2002 16:02:57 -0000       1.1.4.9
+++ c-simplify.c        10 Aug 2002 05:39:41 -0000
@@ -1367,7 +1374,7 @@ simplify_compound_lval (expr_p, pre_p, p
     abort ();
 
   /* Unshare the reference.  */
-  walk_tree (expr_p, copy_tree_r, NULL, NULL);
+  walk_tree (expr_p, mostly_copy_tree_r, NULL, NULL);
 
   /* Create a stack with all the array dimensions so that they can be
      simplified from left to right (to match user expectations).  */



More information about the Gcc-patches mailing list