lambda-code.c (remove_iv): New.

* lambda-code.c (remove_iv): New.
	(lambda_loopnest_to_gcc_loopnest): Use remove_iv.


Co-Authored-By: Sebastian Pop <sebpop@gmail.com>

From-SVN: r125605
This commit is contained in:
Jan Sjodin 2007-06-10 21:00:59 +00:00 committed by Sebastian Pop
parent 79f5e44262
commit 51c0074eed
2 changed files with 48 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2007-06-10 Jan Sjodin <jan.sjodin@amd.com>
Sebastian Pop <sebpop@gmail.com>
* lambda-code.c (remove_iv): New.
(lambda_loopnest_to_gcc_loopnest): Use remove_iv.
2007-06-10 Zdenek Dvorak <dvorakz@suse.cz> 2007-06-10 Zdenek Dvorak <dvorakz@suse.cz>
* tree-data-ref.c (dr_analyze_alias): Handle case smt is NULL. * tree-data-ref.c (dr_analyze_alias): Handle case smt is NULL.

View File

@ -1616,6 +1616,45 @@ lle_to_gcc_expression (lambda_linear_expression lle,
return force_gimple_operand (fold (expr), stmts_to_insert, true, resvar); return force_gimple_operand (fold (expr), stmts_to_insert, true, resvar);
} }
/* Remove the induction variable defined at IV_STMT. */
static void
remove_iv (tree iv_stmt)
{
if (TREE_CODE (iv_stmt) == PHI_NODE)
{
int i;
for (i = 0; i < PHI_NUM_ARGS (iv_stmt); i++)
{
tree stmt;
imm_use_iterator imm_iter;
tree arg = PHI_ARG_DEF (iv_stmt, i);
bool used = false;
if (TREE_CODE (arg) != SSA_NAME)
continue;
FOR_EACH_IMM_USE_STMT (stmt, imm_iter, arg)
if (stmt != iv_stmt)
used = true;
if (!used)
remove_iv (SSA_NAME_DEF_STMT (arg));
}
remove_phi_node (iv_stmt, NULL_TREE, true);
}
else
{
block_stmt_iterator bsi = bsi_for_stmt (iv_stmt);
bsi_remove (&bsi, true);
release_defs (iv_stmt);
}
}
/* Transform a lambda loopnest NEW_LOOPNEST, which had TRANSFORM applied to /* Transform a lambda loopnest NEW_LOOPNEST, which had TRANSFORM applied to
it, back into gcc code. This changes the it, back into gcc code. This changes the
loops, their induction variables, and their bodies, so that they loops, their induction variables, and their bodies, so that they
@ -1797,6 +1836,9 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
propagate_value (use_p, newiv); propagate_value (use_p, newiv);
update_stmt (stmt); update_stmt (stmt);
} }
/* Remove the now unused induction variable. */
remove_iv (oldiv_stmt);
} }
VEC_free (tree, heap, new_ivs); VEC_free (tree, heap, new_ivs);
} }