re PR tree-optimization/52912 (ICE: verify_ssa failed)
authorRichard Guenther <rguenther@suse.de>
Wed, 11 Apr 2012 08:12:33 +0000 (08:12 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Wed, 11 Apr 2012 08:12:33 +0000 (08:12 +0000)
2012-04-11  Richard Guenther  <rguenther@suse.de>

PR tree-optimization/52912
* tree-ssa-threadupdate.c (thread_block): Tell the cfg
manipulation code we are threading through a loop header
to an exit destination.

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

From-SVN: r186303

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr52912.c [new file with mode: 0644]
gcc/tree-ssa-threadupdate.c

index cc84f50f3db819ec893ad0c35468b04f81a830bf..24efa857d85edeed6d475f457fe65ab632e2e0f4 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-11  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/52912
+       * tree-ssa-threadupdate.c (thread_block): Tell the cfg
+       manipulation code we are threading through a loop header
+       to an exit destination.
+
 2012-04-10  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
        * tree.h (warn_if_unused_value): Move declaration from here.
index def1d1fb6423e8ff7d7aa9725cf9d63fcdd84e13..08293166910bdab32f29dd7255368c2d6d0410b2 100644 (file)
@@ -1,3 +1,8 @@
+2012-04-11  Richard Guenther  <rguenther@suse.de>
+
+       PR tree-optimization/52912
+       * gcc.dg/torture/pr52912.c: New testcase.
+
 2010-04-10  Michael Matz  <matz@suse.de>
 
        * gcc.dg/vect/vect-outer-1-big-array.c: Adjust.
diff --git a/gcc/testsuite/gcc.dg/torture/pr52912.c b/gcc/testsuite/gcc.dg/torture/pr52912.c
new file mode 100644 (file)
index 0000000..3ae5758
--- /dev/null
@@ -0,0 +1,17 @@
+/* { dg-do compile } */
+
+int a, b, c;
+static int
+fn1 (p1)
+{
+lbl_549:
+      if (p1)
+               goto lbl_549;
+          return 0;
+}
+
+void
+fn2 ()
+{
+      b = (c && a) > fn1 (c) >= c;
+}
index 687eee0485ae09cd51934289f3adca3ce2184737..018092a7a3aeec6aece7c7fe867d2f6b534ab9cc 100644 (file)
@@ -661,6 +661,13 @@ thread_block (basic_block bb, bool noloop_only)
   /* We do not update dominance info.  */
   free_dominance_info (CDI_DOMINATORS);
 
+  /* We know we only thread through the loop header to loop exits.
+     Let the basic block duplication hook know we are not creating
+     a multiple entry loop.  */
+  if (noloop_only
+      && bb == bb->loop_father->header)
+    set_loop_copy (bb->loop_father, loop_outer (bb->loop_father));
+
   /* Now create duplicates of BB.
 
      Note that for a block with a high outgoing degree we can waste
@@ -692,6 +699,10 @@ thread_block (basic_block bb, bool noloop_only)
   htab_delete (redirection_data);
   redirection_data = NULL;
 
+  if (noloop_only
+      && bb == bb->loop_father->header)
+    set_loop_copy (bb->loop_father, NULL);
+
   /* Indicate to our caller whether or not any jumps were threaded.  */
   return local_info.jumps_threaded;
 }