re PR tree-optimization/81118 (ice in remove_redundant_iv_tests)
authorRichard Biener <rguenther@suse.de>
Mon, 19 Jun 2017 15:08:02 +0000 (15:08 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 19 Jun 2017 15:08:02 +0000 (15:08 +0000)
2017-06-19  Richard Biener  <rguenther@suse.de>

PR middle-end/81118
* tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Clear niter
estimates if we changed anything.

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

From-SVN: r249374

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

index 99a7242e5b25da8492991cde871c0bdda7e435b0..64fa3893090036bee15ad085d1e2a105a96c75b0 100644 (file)
@@ -1,3 +1,9 @@
+2017-06-19  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/81118
+       * tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Clear niter
+       estimates if we changed anything.
+
 2017-06-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/80887
index 47e2a984f23d3062a9b0ef75a3d44a7c55fd8bc2..a27eac2395e291f38fe99d80f426d6bb91888b2d 100644 (file)
@@ -1,3 +1,8 @@
+2017-06-19  Richard Biener  <rguenther@suse.de>
+
+       PR middle-end/81118
+       * gcc.dg/torture/pr81118.c: New testcase.
+
 2017-06-19  Richard Biener  <rguenther@suse.de>
 
        PR tree-optimization/80887
diff --git a/gcc/testsuite/gcc.dg/torture/pr81118.c b/gcc/testsuite/gcc.dg/torture/pr81118.c
new file mode 100644 (file)
index 0000000..42d83fd
--- /dev/null
@@ -0,0 +1,14 @@
+/* { dg-do compile } */
+/* { dg-additional-options "-w" } */
+
+int a[7], b;
+int c()
+{
+  int d, e;
+  for (; d; d++)
+    if (a[d])
+      if (b)
+       return;
+      else if (d >= e)
+       return 0;
+}
index 4cab592ee772f6d5847fba9979ef07996de15793..8bb5e237395259dfa7d49ccb3b1ab1932f1cd781 100644 (file)
@@ -839,7 +839,12 @@ cleanup_tree_cfg_noloop (void)
   timevar_pop (TV_TREE_CLEANUP_CFG);
 
   if (changed && current_loops)
-    loops_state_set (LOOPS_NEED_FIXUP);
+    {
+      /* Removing edges and/or blocks may make recorded bounds refer
+         to stale GIMPLE stmts now, so clear them.  */
+      free_numbers_of_iterations_estimates (cfun);
+      loops_state_set (LOOPS_NEED_FIXUP);
+    }
 
   return changed;
 }