summaryrefslogtreecommitdiff
path: root/gcc/lambda-code.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-09 21:22:19 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-09 21:22:19 +0000
commit777276542be26fbcf98373c21d0a99c546f622b7 (patch)
tree9261d15e966c4aa492652b1e3fce9092f2351fbd /gcc/lambda-code.c
parent01dc04f9bdada9f9450ebae891b201890539df94 (diff)
downloadgcc-777276542be26fbcf98373c21d0a99c546f622b7.tar.gz
2008-01-09 Sebastian Pop <sebastian.pop@amd.com>
PR tree-optimization/34017 * lambda-code.c (lambda_loopnest_to_gcc_loopnest): Generate code also for PHI_NODE expressions. * gcc.dg/tree-ssa/pr34017.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131435 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lambda-code.c')
-rw-r--r--gcc/lambda-code.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/lambda-code.c b/gcc/lambda-code.c
index 45f31b1a263..0b67231a58d 100644
--- a/gcc/lambda-code.c
+++ b/gcc/lambda-code.c
@@ -1675,7 +1675,6 @@ remove_iv (tree 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
@@ -1699,6 +1698,7 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
{
struct loop *temp;
size_t i = 0;
+ int j;
size_t depth = 0;
VEC(tree,heap) *new_ivs = NULL;
tree oldiv;
@@ -1837,8 +1837,6 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
tree newiv, stmts;
lambda_body_vector lbv, newlbv;
- gcc_assert (TREE_CODE (stmt) != PHI_NODE);
-
/* Compute the new expression for the induction
variable. */
depth = VEC_length (tree, new_ivs);
@@ -1850,7 +1848,8 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
newiv = lbv_to_gcc_expression (newlbv, TREE_TYPE (oldiv),
new_ivs, &stmts);
- if (stmts)
+
+ if (stmts && TREE_CODE (stmt) != PHI_NODE)
{
bsi = bsi_for_stmt (stmt);
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
@@ -1858,6 +1857,12 @@ lambda_loopnest_to_gcc_loopnest (struct loop *old_loopnest,
FOR_EACH_IMM_USE_ON_STMT (use_p, imm_iter)
propagate_value (use_p, newiv);
+
+ if (stmts && TREE_CODE (stmt) == PHI_NODE)
+ for (j = 0; j < PHI_NUM_ARGS (stmt); j++)
+ if (PHI_ARG_DEF (stmt, j) == newiv)
+ bsi_insert_on_edge (PHI_ARG_EDGE (stmt, j), stmts);
+
update_stmt (stmt);
}