re PR tree-optimization/69999 (ICE in verify_loop_structure, at cfgloop.c:1639 (error...
authorJeff Law <law@redhat.com>
Mon, 29 Feb 2016 22:45:41 +0000 (15:45 -0700)
committerJeff Law <law@gcc.gnu.org>
Mon, 29 Feb 2016 22:45:41 +0000 (15:45 -0700)
PR tree-optimization/69999
* gimple-ssa-split-paths.c (split_paths): When duplicating a block
with an outgoing edge marked with EDGE_IRREDUCIBLE_LOOP, schedule
loop cleanups.

PR tree-optimization/69999
* gcc.c-torture/compile/pr69999.c: New test.

From-SVN: r233824

gcc/ChangeLog
gcc/gimple-ssa-split-paths.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr69999.c [new file with mode: 0644]

index 966e06dd761e4db97ef3d38aaac54c97e029a7f4..653b51e764b26d20ce82003804080470a9db8c7d 100644 (file)
@@ -1,3 +1,10 @@
+2016-02-28  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/69999
+       * gimple-ssa-split-paths.c (split_paths): When duplicating a block
+       with an outgoing edge marked with EDGE_IRREDUCIBLE_LOOP, schedule
+       loop cleanups.
+
 2016-02-29  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/69994
index ac6de8147df0fe0ef8e822abff0a3e1b4648338a..d566f64c70be4acc52582716d5637dcf9ff513df 100644 (file)
@@ -294,6 +294,24 @@ split_paths ()
          basic_block pred0 = EDGE_PRED (bb, 0)->src;
          transform_duplicate (pred0, bb);
          changed = true;
+
+         /* If BB has an outgoing edge marked as IRREDUCIBLE, then
+            duplicating BB may result in an irreducible region turning
+            into a natural loop.
+
+            Long term we might want to hook this into the block
+            duplication code, but as we've seen with similar changes
+            for edge removal, that can be somewhat risky.  */
+         if (EDGE_SUCC (bb, 0)->flags & EDGE_IRREDUCIBLE_LOOP
+             || EDGE_SUCC (bb, 1)->flags & EDGE_IRREDUCIBLE_LOOP)
+           {
+             if (dump_file && (dump_flags & TDF_DETAILS))
+                 fprintf (dump_file,
+                          "Join block %d has EDGE_IRREDUCIBLE_LOOP set.  "
+                          "Scheduling loop fixups.\n",
+                          bb->index);
+             loops_state_set (LOOPS_NEED_FIXUP);
+           }
        }
     }
 
index a97af6481db3df78ceed7f3442c385c0533259f0..49577ee87a3c3f21dc3c5b7857c81b9e8e16040b 100644 (file)
@@ -1,3 +1,8 @@
+2016-02-29  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/69999
+       * gcc.c-torture/compile/pr69999.c: New test.
+
 2016-02-29  Yuri Rumyantsev  <ysrumyan@gmail.com>
 
        PR tree-optimization/69652
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr69999.c b/gcc/testsuite/gcc.c-torture/compile/pr69999.c
new file mode 100644 (file)
index 0000000..5659ce4
--- /dev/null
@@ -0,0 +1,16 @@
+int uh;
+
+void
+ha(void)
+{
+  while (uh) {
+    for (uh = 0; uh < 1; ++uh) {
+      uh = 0;
+      if (uh != 0)
+ ts:
+        uh %= uh;
+    }
+    ++uh;
+  }
+  goto ts;
+}