diff options
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.c')
-rw-r--r-- | gcc/tree-ssa-loop-unswitch.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-ssa-loop-unswitch.c b/gcc/tree-ssa-loop-unswitch.c index d6faa37..2edc000 100644 --- a/gcc/tree-ssa-loop-unswitch.c +++ b/gcc/tree-ssa-loop-unswitch.c @@ -471,7 +471,6 @@ find_loop_guard (struct loop *loop) { basic_block header = loop->header; edge guard_edge, te, fe; - /* bitmap processed, known_invariants;*/ basic_block *body = NULL; unsigned i; tree use; @@ -529,6 +528,16 @@ find_loop_guard (struct loop *loop) else return NULL; + /* Guard edge must skip inner loop. */ + if (!dominated_by_p (CDI_DOMINATORS, loop->inner->header, + guard_edge == fe ? te->dest : fe->dest)) + { + if (dump_file && (dump_flags & TDF_DETAILS)) + fprintf (dump_file, "Guard edge %d --> %d is not around the loop!\n", + guard_edge->src->index, guard_edge->dest->index); + return NULL; + } + if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, "Considering guard %d -> %d in loop %d\n", |