tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME defined in a loop at depth 0 is invariant.

* tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
	defined in a loop at depth 0 is invariant.
	* tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
	* tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Should never
	be called at loop depth 0.

From-SVN: r132835
This commit is contained in:
Sebastian Pop 2008-03-03 11:51:36 +00:00 committed by Sebastian Pop
parent 9310e5e318
commit 6a732743bd
4 changed files with 16 additions and 3 deletions

View File

@ -1,3 +1,11 @@
2008-03-02 Sebastian Pop <sebastian.pop@amd.com>
* tree-scalar-evolution.c (instantiate_parameters_1): An SSA_NAME
defined in a loop at depth 0 is invariant.
* tree-chrec.c (evolution_function_is_invariant_rec_p): Ditto.
* tree-ssa-loop-ivopts.c (expr_invariant_in_loop_p): Should never
be called at loop depth 0.
2008-03-02 Jakub Jelinek <jakub@redhat.com>
PR driver/35420

View File

@ -948,8 +948,9 @@ evolution_function_is_invariant_rec_p (tree chrec, int loopnum)
if (evolution_function_is_constant_p (chrec))
return true;
if (TREE_CODE (chrec) == SSA_NAME
&& expr_invariant_in_loop_p (get_loop (loopnum), chrec))
if (TREE_CODE (chrec) == SSA_NAME
&& (loopnum == 0
|| expr_invariant_in_loop_p (get_loop (loopnum), chrec)))
return true;
if (TREE_CODE (chrec) == POLYNOMIAL_CHREC)

View File

@ -1971,6 +1971,7 @@ instantiate_parameters_1 (struct loop *loop, tree chrec, int flags, htab_t cache
/* A parameter (or loop invariant and we do not want to include
evolutions in outer loops), nothing to do. */
if (!def_bb
|| loop_depth (def_bb->loop_father) == 0
|| (!(flags & INSERT_SUPERLOOP_CHRECS)
&& !flow_bb_inside_loop_p (loop, def_bb)))
return chrec;

View File

@ -1254,7 +1254,8 @@ find_interesting_uses_cond (struct ivopts_data *data, tree stmt, tree *cond_p)
}
/* Returns true if expression EXPR is obviously invariant in LOOP,
i.e. if all its operands are defined outside of the LOOP. */
i.e. if all its operands are defined outside of the LOOP. LOOP
should not be the function body. */
bool
expr_invariant_in_loop_p (struct loop *loop, tree expr)
@ -1262,6 +1263,8 @@ expr_invariant_in_loop_p (struct loop *loop, tree expr)
basic_block def_bb;
unsigned i, len;
gcc_assert (loop_depth (loop) > 0);
if (is_gimple_min_invariant (expr))
return true;