re PR tree-optimization/58326 (ICE in check_loop_closed_ssa_use, at tree-ssa-loop...
authorRichard Biener <rguenther@suse.de>
Mon, 9 Sep 2013 13:18:38 +0000 (13:18 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 9 Sep 2013 13:18:38 +0000 (13:18 +0000)
2013-09-09  Richard Biener  <rguenther@suse.de>

PR middle-end/58326
* cfgloopmanip.c (fix_bb_placements): When fixing the placement
of a subloop record all its block as affecting loop-closed SSA form.

* gcc.dg/torture/pr58326-1.c: New testcase.
* gcc.dg/torture/pr58326-2.c: Likewise.

From-SVN: r202399

gcc/ChangeLog
gcc/cfgloopmanip.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr58326-1.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/torture/pr58326-2.c [new file with mode: 0644]

index 0eb112f92d3c3c8243454c032b076169a708070f..228fd1bad5774bd1fca8edcd3c6aa140c07c60cb 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/58326
+       * cfgloopmanip.c (fix_bb_placements): When fixing the placement
+       of a subloop record all its block as affecting loop-closed SSA form.
+
 2013-09-09  Richard Sandiford  <rdsandiford@googlemail.com>
 
        * expmed.c (lshift_value): Take an unsigned HOST_WIDE_INT instead
index f35e5aedc7902c6591f67ac1248029347c351324..cce5d467f57b1d15871332221e7dc57ba6316f7e 100644 (file)
@@ -223,15 +223,22 @@ fix_bb_placements (basic_block from,
          if (!fix_loop_placement (from->loop_father, irred_invalidated))
            continue;
          target_loop = loop_outer (from->loop_father);
+         if (loop_closed_ssa_invalidated)
+           {
+             basic_block *bbs = get_loop_body (from->loop_father);
+             for (unsigned i = 0; i < from->loop_father->num_nodes; ++i)
+               bitmap_set_bit (loop_closed_ssa_invalidated, bbs[i]->index);
+             free (bbs);
+           }
        }
       else
        {
          /* Ordinary basic block.  */
          if (!fix_bb_placement (from))
            continue;
+         target_loop = from->loop_father;
          if (loop_closed_ssa_invalidated)
            bitmap_set_bit (loop_closed_ssa_invalidated, from->index);
-         target_loop = from->loop_father;
        }
 
       FOR_EACH_EDGE (e, ei, from->succs)
index 9726eb6655f78ea6bc16d35c0199b6f9be740f90..3bb49d9bb77937a9e72b955bf5778cbcdb45f651 100644 (file)
@@ -1,3 +1,9 @@
+2013-09-09  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/58326
+       * gcc.dg/torture/pr58326-1.c: New testcase.
+       * gcc.dg/torture/pr58326-2.c: Likewise.
+
 2013-09-09  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        PR target/57735
diff --git a/gcc/testsuite/gcc.dg/torture/pr58326-1.c b/gcc/testsuite/gcc.dg/torture/pr58326-1.c
new file mode 100644 (file)
index 0000000..3b46eed
--- /dev/null
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+
+int a, *d; 
+long b;
+short c;
+
+void foo ()
+{
+  int e;
+lbl:
+  for (c = 0; c < 2; c++)
+    {
+      if (1 >> b)
+       break;
+      e = *d;
+      for (; a; a++)
+       {
+         *d = e;
+         if (b)
+           goto lbl;
+       }
+    }
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr58326-2.c b/gcc/testsuite/gcc.dg/torture/pr58326-2.c
new file mode 100644 (file)
index 0000000..ddddbbe
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile } */
+
+int a, b, c, d;
+
+void foo ()
+{
+  int e;
+
+lbl:
+  for (c = 0; c < 2; c++)
+    {
+      e = d;
+      for (; a; a++)
+       {
+         d = e;
+         if (b)
+           goto lbl; 
+       }
+    }
+}