This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix PR50767


This fixes an oversight of my patch folding the added stmt in PRE - 
failing to update it.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2011-10-18  Richard Guenther  <rguenther@suse.de>

	PR tree-optimization/50767
	* tree-ssa-pre.c (create_expression_by_pieces): Update the
	folded statement.

	* gcc.dg/torture/pr50767.c: New testcase.

Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c	(revision 180127)
--- gcc/tree-ssa-pre.c	(working copy)
*************** create_expression_by_pieces (basic_block
*** 3188,3194 ****
  
    /* Fold the last statement.  */
    gsi = gsi_last (*stmts);
!   fold_stmt_inplace (&gsi);
  
    /* Add a value number to the temporary.
       The value may already exist in either NEW_SETS, or AVAIL_OUT, because
--- 3188,3195 ----
  
    /* Fold the last statement.  */
    gsi = gsi_last (*stmts);
!   if (fold_stmt_inplace (&gsi))
!     update_stmt (gsi_stmt (gsi));
  
    /* Add a value number to the temporary.
       The value may already exist in either NEW_SETS, or AVAIL_OUT, because
Index: gcc/testsuite/gcc.dg/torture/pr50767.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr50767.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr50767.c	(revision 0)
***************
*** 0 ****
--- 1,21 ----
+ /* { dg-do compile } */
+ /* { dg-options "-fno-tree-copy-prop -fno-tree-dominator-opts" } */
+ 
+ struct S
+ {
+   struct S *s;
+ };
+ 
+ static struct S *ss;
+ struct S *s;
+ 
+ void bar(void);
+ 
+ void foo(void)
+ {
+   for (;;)
+     {
+       s->s = ss;
+       bar ();
+     }
+ }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]