summaryrefslogtreecommitdiff
path: root/gcc/lambda-code.c
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@amd.com>2007-10-19 19:01:58 +0000
committerSebastian Pop <spop@gcc.gnu.org>2007-10-19 19:01:58 +0000
commit671633e94999c9531929f3fa41ee278136565b7b (patch)
tree65725d390db5c25a995bac2ec0111aaf66e74f84 /gcc/lambda-code.c
parent23e8722aedfa0fbde8325a8bc5ca3394ff03d13d (diff)
downloadgcc-671633e94999c9531929f3fa41ee278136565b7b.tar.gz
re PR tree-optimization/23820 (ICE in lambda_loopnest_to_gcc_loopnest, at lambda-code.c:1982)
2007-10-19 Sebastian Pop <sebastian.pop@amd.com> PR tree-optimization/23820 PR tree-optimization/24309 PR tree-optimization/33766 * testsuite/gcc.dg/tree-ssa/pr23820.c: New. * testsuite/gcc.dg/tree-ssa/pr24309.c: New. * testsuite/gcc.dg/tree-ssa/pr33766.c: New. * testsuite/gcc.dg/tree-ssa/ltrans-3.c: XFAILed. * tree-loop-linear.c (perfect_loop_nest_depth): New. (linear_transform_loops): Use perfect_loop_nest_depth. * lambda-code.c (perfect_nest_p): Outer loops in perfect nests should have a single condition: their exit. From-SVN: r129494
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r--gcc/lambda-code.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 84ad869a0ef..db92bc9e2e4 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1972,32 +1972,42 @@ perfect_nest_p (struct loop *loop)
size_t i;
tree exit_cond;
+ /* Loops at depth 0 are perfect nests. */
if (!loop->inner)
return true;
+
bbs = get_loop_body (loop);
exit_cond = get_loop_exit_condition (loop);
+
for (i = 0; i < loop->num_nodes; i++)
{
if (bbs[i]->loop_father == loop)
{
block_stmt_iterator bsi;
+
for (bsi = bsi_start (bbs[i]); !bsi_end_p (bsi); bsi_next (&bsi))
{
tree stmt = bsi_stmt (bsi);
+
+ if (TREE_CODE (stmt) == COND_EXPR
+ && exit_cond != stmt)
+ goto non_perfectly_nested;
+
if (stmt == exit_cond
|| not_interesting_stmt (stmt)
|| stmt_is_bumper_for_loop (loop, stmt))
continue;
+
+ non_perfectly_nested:
free (bbs);
return false;
}
}
}
+
free (bbs);
- /* See if the inner loops are perfectly nested as well. */
- if (loop->inner)
- return perfect_nest_p (loop->inner);
- return true;
+
+ return perfect_nest_p (loop->inner);
}
/* Replace the USES of X in STMT, or uses with the same step as X with Y.