From b7e36a33eb4b756440b9a93f812414a42800f38b Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 27 Aug 2015 17:07:35 +0000 Subject: [PATCH] re PR middle-end/67005 (ICE: in verify_loop_structure, at cfgloop.c:1647 (loop with header n not in loop tree)) 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 | 6 ++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/torture/pr67005.c | 15 +++++++++++++++ gcc/tree-ssa-dce.c | 9 +++++---- 4 files changed, 31 insertions(+), 4 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/torture/pr67005.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6661c960101..c9b3c3a51e2 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2015-08-27 Marek Polacek + + 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 * configure: Regenerate. diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 45a01c5c119..ef3ada08e0a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-08-27 Marek Polacek + + PR middle-end/67005 + * gcc.dg/torture/pr67005.c: New test. + 2015-08-27 Alan Lawrence * 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 index 00000000000..922c5c475e8 --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67005.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ + +int a; +void +f (void) +{ + if (!a); + else + lbl: + a = a; + + if (a) + a = 8; + goto lbl; +} diff --git a/gcc/tree-ssa-dce.c b/gcc/tree-ssa-dce.c index 2d2edc80116..50dfdedff85 100644 --- a/gcc/tree-ssa-dce.c +++ b/gcc/tree-ssa-dce.c @@ -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); } -- 2.30.2