aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-unswitch.c
diff options
context:
space:
mode:
authorYuri Rumyantsev <ysrumyan@gmail.com>2015-10-13 13:08:31 +0000
committerIlya Enkovich <ienkovich@gcc.gnu.org>2015-10-13 13:08:31 +0000
commit8a18fcf4aa1d5c69d93d02ba3b4820ac03851cb2 (patch)
tree3a3fb504ba5df97bcda16929a164ffb73bef27ed /gcc/tree-ssa-loop-unswitch.c
parent92a1d1e1d0a9c07c4ff2c9974f90ed1baee15f27 (diff)
downloadgcc-8a18fcf4aa1d5c69d93d02ba3b4820ac03851cb2.zip
gcc-8a18fcf4aa1d5c69d93d02ba3b4820ac03851cb2.tar.gz
gcc-8a18fcf4aa1d5c69d93d02ba3b4820ac03851cb2.tar.bz2
PR tree-optimization/67909, 67947
gcc/ 2014-10-13 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/67909, 67947 * tree-ssa-loop-unswitch.c (find_loop_guard): Add check that GUARD_EDGE really skip the inner loop. gcc/testsuite/ 2014-10-13 Yuri Rumyantsev <ysrumyan@gmail.com> PR tree-optimization/67909, 67947 * gcc.dg/torture/pr67947.c: New test. From-SVN: r228760
Diffstat (limited to 'gcc/tree-ssa-loop-unswitch.c')
-rw-r--r--gcc/tree-ssa-loop-unswitch.c11
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",