From 0c6072a3fc25e656c606247df51a448ab21326c0 Mon Sep 17 00:00:00 2001 From: Jeff Law Date: Mon, 29 Feb 2016 15:45:41 -0700 Subject: [PATCH] re PR tree-optimization/69999 (ICE in verify_loop_structure, at cfgloop.c:1639 (error: loop with header 3 not in loop tree) at -O3 or -Ofast) 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 | 7 +++++++ gcc/gimple-ssa-split-paths.c | 18 ++++++++++++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.c-torture/compile/pr69999.c | 16 ++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 gcc/testsuite/gcc.c-torture/compile/pr69999.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 966e06dd761..653b51e764b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2016-02-28 Jeff Law + + 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 PR tree-optimization/69994 diff --git a/gcc/gimple-ssa-split-paths.c b/gcc/gimple-ssa-split-paths.c index ac6de8147df..d566f64c70b 100644 --- a/gcc/gimple-ssa-split-paths.c +++ b/gcc/gimple-ssa-split-paths.c @@ -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); + } } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a97af6481db..49577ee87a3 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2016-02-29 Jeff Law + + PR tree-optimization/69999 + * gcc.c-torture/compile/pr69999.c: New test. + 2016-02-29 Yuri Rumyantsev 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 index 00000000000..5659ce48a17 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr69999.c @@ -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; +} -- 2.30.2