public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix PR55270
@ 2013-01-29 10:39 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2013-01-29 10:39 UTC (permalink / raw)
  To: gcc-patches


This fixes PR55270 - we need to fixup loops after phicprop as
that removes edges without doing so.  The following patch makes
us rely on cfgcleanup scheduled after the pass for this.

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

Richard.

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

	PR tree-optimization/55270
	* tree-ssa-dom.c (eliminate_degenerate_phis): If we changed
	the CFG, schedule loops for fixup.

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

Index: gcc/tree-ssa-dom.c
===================================================================
--- gcc/tree-ssa-dom.c	(revision 195530)
+++ gcc/tree-ssa-dom.c	(working copy)
@@ -3006,7 +3006,12 @@ eliminate_degenerate_phis (void)
     }
 
   if (cfg_altered)
-    free_dominance_info (CDI_DOMINATORS);
+    {
+      free_dominance_info (CDI_DOMINATORS);
+      /* If we changed the CFG schedule loops for fixup by cfgcleanup.  */
+      if (current_loops)
+	loops_state_set (LOOPS_NEED_FIXUP);
+    }
 
   /* Propagation of const and copies may make some EH edges dead.  Purge
      such edges from the CFG as needed.  */
Index: gcc/testsuite/gcc.dg/torture/pr55270.c
===================================================================
--- gcc/testsuite/gcc.dg/torture/pr55270.c	(revision 0)
+++ gcc/testsuite/gcc.dg/torture/pr55270.c	(working copy)
@@ -0,0 +1,22 @@
+/* { dg-do compile } */
+
+unsigned a, b, c;
+
+void f(void)
+{
+  for(; a; a++)
+    {
+      long *p1 = (long *)&b;
+
+      if(*p1)
+	return;
+
+      if(b && (*p1 = b) || c && ++*p1)
+	{
+	  unsigned *p2 = &b;
+
+	  for(*p2 = 0; *p2 < 1;)
+	    for(; b; b++);
+	}
+    }
+}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2013-01-29 10:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-29 10:39 [PATCH] Fix PR55270 Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).