]> gcc.gnu.org Git - gcc.git/commitdiff
re PR tree-optimization/64357 (ICE at -Os on x86_64-linux-gnu in check_loop_closed_ss...
authorRichard Biener <rguenther@suse.de>
Mon, 12 Jan 2015 15:34:37 +0000 (15:34 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 12 Jan 2015 15:34:37 +0000 (15:34 +0000)
2015-01-12  Richard Biener  <rguenther@suse.de>

PR middle-end/64357
* tree-cfg.c (gimple_can_merge_blocks_p): Protect simple
latches properly.

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

From-SVN: r219473

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr64357.c [new file with mode: 0644]
gcc/tree-cfg.c

index c757e0b175a15f1b1af66de5e5b139ed5da76567..dfba0bc433cecbdbae3fc62c8bdd142175c788cf 100644 (file)
@@ -1,3 +1,9 @@
+2015-01-12  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64357
+       * tree-cfg.c (gimple_can_merge_blocks_p): Protect simple
+       latches properly.
+
 2015-01-12  Kyrylo Tkachov  <kyrylo.tkachov@arm.com>
 
        * config/arm/arm.c (arm_cortex_a12_tune): Update entries to match
index 6ff63449c807ab734ca9e6ded0654211f0a2f4c8..3cda6b359a616f1ee17ad926d3b0408cdbca7475 100644 (file)
@@ -1,3 +1,8 @@
+2015-01-12  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/64357
+       * gcc.dg/torture/pr64357.c: New testcase.
+
 2015-01-12  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gcc.target/i386/nop-mcount.c: Properly place {} in target
diff --git a/gcc/testsuite/gcc.dg/torture/pr64357.c b/gcc/testsuite/gcc.dg/torture/pr64357.c
new file mode 100644 (file)
index 0000000..ff966ef
--- /dev/null
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+
+int a, b, c, d, e, f;
+
+long long
+fn1 (int p)
+{
+  return p ? p : 1;
+}
+
+static int
+fn2 ()
+{
+lbl:
+  for (; f;)
+    return 0;
+  for (;;)
+    {
+      for (b = 0; b; ++b)
+       if (d)
+         goto lbl;
+      c = e;
+    }
+}
+
+void
+fn3 ()
+{
+  for (; a; a = fn1 (a))
+    {
+      fn2 ();
+      e = 0;
+    }
+}
index a9a2c2f73921dbdf8201e9b4a2b1d0fd1d6fb413..38e5e7db432912e5d5184d1c7e90d43b2f4e8ec3 100644 (file)
@@ -1723,11 +1723,13 @@ gimple_can_merge_blocks_p (basic_block a, basic_block b)
     }
 
   /* Protect simple loop latches.  We only want to avoid merging
-     the latch with the loop header in this case.  */
+     the latch with the loop header or with a block in another
+     loop in this case.  */
   if (current_loops
       && b->loop_father->latch == b
       && loops_state_satisfies_p (LOOPS_HAVE_SIMPLE_LATCHES)
-      && b->loop_father->header == a)
+      && (b->loop_father->header == a
+         || b->loop_father != a->loop_father))
     return false;
 
   /* It must be possible to eliminate all phi nodes in B.  If ssa form
This page took 0.106959 seconds and 5 git commands to generate.