diff options
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r-- | gcc/lambda-code.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c index 84ad869..db92bc9 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. |