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 PR55862


The following reverts a change I did during the various PRE cleanups.

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

Richard.

2013-01-04  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/55862
	* tree-ssa-pre.c (phi_translate_1): Valueize SSA names after
	translating them through PHI nodes.

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

Index: gcc/tree-ssa-pre.c
===================================================================
*** gcc/tree-ssa-pre.c	(revision 194900)
--- gcc/tree-ssa-pre.c	(working copy)
*************** phi_translate_1 (pre_expr expr, bitmap_s
*** 1729,1734 ****
--- 1729,1738 ----
  	    edge e = find_edge (pred, gimple_bb (def_stmt));
  	    tree def = PHI_ARG_DEF (def_stmt, e->dest_idx);
  
+ 	    /* Valueize it.  */
+ 	    if (TREE_CODE (def) == SSA_NAME)
+ 	      def = VN_INFO (def)->valnum;
+ 
  	    /* Handle constant. */
  	    if (is_gimple_min_invariant (def))
  	      return get_or_alloc_expr_for_constant (def);
Index: gcc/testsuite/gcc.dg/torture/pr55862.c
===================================================================
*** gcc/testsuite/gcc.dg/torture/pr55862.c	(revision 0)
--- gcc/testsuite/gcc.dg/torture/pr55862.c	(working copy)
***************
*** 0 ****
--- 1,31 ----
+ /* { dg-do compile } */
+ 
+ int g, a, *b;
+ 
+ void f(void)
+ {
+   int *p;
+ 
+   if(g)
+     {
+       int **k = &p;
+ 
+       for(; g; p++)
+ 	for(a = 0; a < 1; a++)
+ 	  {
+ 	    int *c = p;
+ label2:
+ 	    if(a < 1)
+ 	      *c = 0;
+ 	  }
+ 
+       goto label1;
+ 
+       while(g++)
+ 	for(*b = 0; *b; b++)
+ 	  label1:
+ 	      ;
+     }
+ 
+   goto label2;
+ }


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