Commit 92d2b330 by Sebastian Pop Committed by Sebastian Pop

lambda-code.c (lambda_loopnest_to_gcc_loopnest, [...]): Use…

lambda-code.c (lambda_loopnest_to_gcc_loopnest, [...]): Use standard_iv_increment_position for computing the bsi position for create_iv.

	* lambda-code.c (lambda_loopnest_to_gcc_loopnest, perfect_nestify):
	Use standard_iv_increment_position for computing the bsi position
	for create_iv.
	* tree-ssa-loop-manip.c (create_iv): Add a comment on how to compute
	the bsi position.

From-SVN: r95013
parent 31c3e631
2005-02-14 Sebastian Pop <pop@cri.ensmp.fr>
* lambda-code.c (lambda_loopnest_to_gcc_loopnest, perfect_nestify):
Use standard_iv_increment_position for computing the bsi position
for create_iv.
* tree-ssa-loop-manip.c (create_iv): Add a comment on how to compute
the bsi position.
2005-02-13 Zdenek Dvorak <dvorakz@suse.cz> 2005-02-13 Zdenek Dvorak <dvorakz@suse.cz>
PR target/17428 PR target/17428
......
...@@ -1873,6 +1873,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1873,6 +1873,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
tree newupperbound, newlowerbound; tree newupperbound, newlowerbound;
lambda_linear_expression offset; lambda_linear_expression offset;
tree type; tree type;
bool insert_after;
oldiv = VEC_index (tree, old_ivs, i); oldiv = VEC_index (tree, old_ivs, i);
type = TREE_TYPE (oldiv); type = TREE_TYPE (oldiv);
...@@ -1915,14 +1916,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest, ...@@ -1915,14 +1916,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
bsi = bsi_start (bb); bsi = bsi_start (bb);
bsi_insert_after (&bsi, stmts, BSI_NEW_STMT); bsi_insert_after (&bsi, stmts, BSI_NEW_STMT);
/* Create the new iv, and insert it's increment on the latch /* Create the new iv. */
block. */
bb = EDGE_PRED (temp->latch, 0)->src; standard_iv_increment_position (temp, &bsi, &insert_after);
bsi = bsi_last (bb);
create_iv (newlowerbound, create_iv (newlowerbound,
build_int_cst (type, LL_STEP (newloop)), build_int_cst (type, LL_STEP (newloop)),
ivvar, temp, &bsi, false, &ivvar, ivvar, temp, &bsi, insert_after, &ivvar,
&ivvarinced); &ivvarinced);
/* Replace the exit condition with the new upper bound /* Replace the exit condition with the new upper bound
...@@ -2297,6 +2296,7 @@ perfect_nestify (struct loops *loops, ...@@ -2297,6 +2296,7 @@ perfect_nestify (struct loops *loops,
basic_block preheaderbb, headerbb, bodybb, latchbb, olddest; basic_block preheaderbb, headerbb, bodybb, latchbb, olddest;
size_t i; size_t i;
block_stmt_iterator bsi; block_stmt_iterator bsi;
bool insert_after;
edge e; edge e;
struct loop *newloop; struct loop *newloop;
tree phi; tree phi;
...@@ -2377,10 +2377,10 @@ perfect_nestify (struct loops *loops, ...@@ -2377,10 +2377,10 @@ perfect_nestify (struct loops *loops,
/* Create the new iv. */ /* Create the new iv. */
ivvar = create_tmp_var (integer_type_node, "perfectiv"); ivvar = create_tmp_var (integer_type_node, "perfectiv");
add_referenced_tmp_var (ivvar); add_referenced_tmp_var (ivvar);
bsi = bsi_last (EDGE_PRED (newloop->latch, 0)->src); standard_iv_increment_position (newloop, &bsi, &insert_after);
create_iv (VEC_index (tree, lbounds, 0), create_iv (VEC_index (tree, lbounds, 0),
build_int_cst (integer_type_node, VEC_index (int, steps, 0)), build_int_cst (integer_type_node, VEC_index (int, steps, 0)),
ivvar, newloop, &bsi, false, &ivvar, &ivvarinced); ivvar, newloop, &bsi, insert_after, &ivvar, &ivvarinced);
/* Create the new upper bound. This may be not just a variable, so we copy /* Create the new upper bound. This may be not just a variable, so we copy
it to one just in case. */ it to one just in case. */
...@@ -2392,7 +2392,12 @@ perfect_nestify (struct loops *loops, ...@@ -2392,7 +2392,12 @@ perfect_nestify (struct loops *loops,
VEC_index (tree, ubounds, 0)); VEC_index (tree, ubounds, 0));
uboundvar = make_ssa_name (uboundvar, stmt); uboundvar = make_ssa_name (uboundvar, stmt);
TREE_OPERAND (stmt, 0) = uboundvar; TREE_OPERAND (stmt, 0) = uboundvar;
if (insert_after)
bsi_insert_after (&bsi, stmt, BSI_SAME_STMT);
else
bsi_insert_before (&bsi, stmt, BSI_SAME_STMT); bsi_insert_before (&bsi, stmt, BSI_SAME_STMT);
COND_EXPR_COND (exit_condition) = build (GE_EXPR, COND_EXPR_COND (exit_condition) = build (GE_EXPR,
boolean_type_node, boolean_type_node,
uboundvar, uboundvar,
......
...@@ -41,7 +41,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA ...@@ -41,7 +41,8 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
It is expected that neither BASE nor STEP are shared with other expressions It is expected that neither BASE nor STEP are shared with other expressions
(unless the sharing rules allow this). Use VAR as a base var_decl for it (unless the sharing rules allow this). Use VAR as a base var_decl for it
(if NULL, a new temporary will be created). The increment will occur at (if NULL, a new temporary will be created). The increment will occur at
INCR_POS (after it if AFTER is true, before it otherwise). The ssa versions INCR_POS (after it if AFTER is true, before it otherwise). INCR_POS and
AFTER can be computed using standard_iv_increment_position. The ssa versions
of the variable before and after increment will be stored in VAR_BEFORE and of the variable before and after increment will be stored in VAR_BEFORE and
VAR_AFTER (unless they are NULL). */ VAR_AFTER (unless they are NULL). */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment