summaryrefslogtreecommitdiff
path: root/gcc/lambda-code.c
diff options
context:
space:
mode:
authorJan Sjodin <jan.sjodin@amd.com>2007-06-10 21:00:59 +0000
committerSebastian Pop <spop@gcc.gnu.org>2007-06-10 21:00:59 +0000
commit51c0074eed92e71feb016b7e1165bafc89b92839 (patch)
tree2e58f84143ae50107585f822869b88c2ff3b16b2 /gcc/lambda-code.c
parent79f5e442625680fbd5c12517419e990609bb2810 (diff)
downloadgcc-51c0074eed92e71feb016b7e1165bafc89b92839.tar.gz
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
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r--gcc/lambda-code.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 501079f6cad..91d82f7913c 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1616,6 +1616,45 @@ lle_to_gcc_expression (lambda_linear_expression lle,
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
it, back into gcc code. This changes the
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);
update_stmt (stmt);
}
+
+ /* Remove the now unused induction variable. */
+ remove_iv (oldiv_stmt);
}
VEC_free (tree, heap, new_ivs);
}