From 21e4389f5029128cf6dc6377ffe678711e91aee4 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 19 Jun 2017 15:08:02 +0000 Subject: [PATCH] re PR tree-optimization/81118 (ice in remove_redundant_iv_tests) 2017-06-19 Richard Biener 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr81118.c | 14 ++++++++++++++ gcc/tree-cfgcleanup.c | 7 ++++++- 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr81118.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 99a7242e5b2..64fa3893090 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2017-06-19 Richard Biener + + PR middle-end/81118 + * tree-cfgcleanup.c (cleanup_tree_cfg_noloop): Clear niter + estimates if we changed anything. + 2017-06-19 Richard Biener PR tree-optimization/80887 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 47e2a984f23..a27eac2395e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-06-19 Richard Biener + + PR middle-end/81118 + * gcc.dg/torture/pr81118.c: New testcase. + 2017-06-19 Richard Biener 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 index 00000000000..42d83fd0b07 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr81118.c @@ -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; +} diff --git a/gcc/tree-cfgcleanup.c b/gcc/tree-cfgcleanup.c index 4cab592ee77..8bb5e237395 100644 --- a/gcc/tree-cfgcleanup.c +++ b/gcc/tree-cfgcleanup.c @@ -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; } -- 2.30.2