re PR middle-end/67005 (ICE: in verify_loop_structure, at cfgloop.c:1647 (loop with...
authorMarek Polacek <polacek@redhat.com>
Thu, 27 Aug 2015 17:07:35 +0000 (17:07 +0000)
committerMarek Polacek <mpolacek@gcc.gnu.org>
Thu, 27 Aug 2015 17:07:35 +0000 (17:07 +0000)
PR middle-end/67005
* tree-ssa-dce.c (remove_dead_stmt): Also schedule fixup if removing
an entry into an irreducible region.

* gcc.dg/torture/pr67005.c: New test.

From-SVN: r227268

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

index 6661c960101bdc06487bed6766e129aca091742f..c9b3c3a51e2c5aaeb22708b24f432dbdaa7abbf7 100644 (file)
@@ -1,3 +1,9 @@
+2015-08-27  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/67005
+       * tree-ssa-dce.c (remove_dead_stmt): Also schedule fixup if removing
+       an entry into an irreducible region.
+
 2015-08-27  Francois-Xavier Coudert  <fxcoudert@gcc.gnu.org>
 
        * configure: Regenerate.
index 45a01c5c11975d8fb14845f82f1db22d40ee7b7b..ef3ada08e0a8b627b1bbd4931a9d4e62882f6ebd 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-27  Marek Polacek  <polacek@redhat.com>
+
+       PR middle-end/67005
+       * gcc.dg/torture/pr67005.c: New test.
+
 2015-08-27  Alan Lawrence  <alan.lawrence@arm.com>
 
        * gcc.dg/tree-ssa/sra-15.c: New.
diff --git a/gcc/testsuite/gcc.dg/torture/pr67005.c b/gcc/testsuite/gcc.dg/torture/pr67005.c
new file mode 100644 (file)
index 0000000..922c5c4
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+
+int a;
+void
+f (void)
+{
+  if (!a);
+  else
+  lbl:
+    a = a;
+
+  if (a)
+    a = 8;
+  goto lbl;
+}
index 2d2edc801168d9c71e34d3f25b51c2634624fc6f..50dfdedff85637e3222c3a22a8adefdbe111b29b 100644 (file)
@@ -1125,10 +1125,11 @@ remove_dead_stmt (gimple_stmt_iterator *i, basic_block bb)
        if (e != e2)
          {
            cfg_altered = true;
-           /* If we made a BB unconditionally exit a loop then this
-              transform alters the set of BBs in the loop.  Schedule
-              a fixup.  */
-           if (loop_exit_edge_p (bb->loop_father, e))
+           /* If we made a BB unconditionally exit a loop or removed
+              an entry into an irreducible region, then this transform
+              alters the set of BBs in the loop.  Schedule a fixup.  */
+           if (loop_exit_edge_p (bb->loop_father, e)
+               || (e2->dest->flags & BB_IRREDUCIBLE_LOOP))
              loops_state_set (LOOPS_NEED_FIXUP);
            remove_edge (e2);
          }