diff options
author | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-12 20:20:58 +0000 |
---|---|---|
committer | rakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-09-12 20:20:58 +0000 |
commit | b2ca91ff433a3a2431c9ffa7c55e978313445012 (patch) | |
tree | 92287a41e394dedad2c7931504cf35555ea68d16 /gcc/tree-ssa-loop-manip.c | |
parent | 0c07444c6de5bb4e3c0e7e872e35a2db7cb8f85d (diff) | |
download | gcc-b2ca91ff433a3a2431c9ffa7c55e978313445012.tar.gz |
* tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname
arguments of the phi nodes correctly.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@87405 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-manip.c')
-rw-r--r-- | gcc/tree-ssa-loop-manip.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-manip.c b/gcc/tree-ssa-loop-manip.c index cde3ce8fb4d..e6ff8a80559 100644 --- a/gcc/tree-ssa-loop-manip.c +++ b/gcc/tree-ssa-loop-manip.c @@ -395,17 +395,26 @@ split_loop_exit_edge (edge exit) { basic_block dest = exit->dest; basic_block bb = loop_split_edge_with (exit, NULL); - tree phi, new_phi, new_name; + tree phi, new_phi, new_name, name; use_operand_p op_p; for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) { op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, bb->succ); - new_name = duplicate_ssa_name (USE_FROM_PTR (op_p), NULL); + name = USE_FROM_PTR (op_p); + + /* If the argument of the phi node is a constant, we do not need + to keep it inside loop. */ + if (TREE_CODE (name) != SSA_NAME) + continue; + + /* Otherwise create an auxiliary phi node that will copy the value + of the ssa name out of the loop. */ + new_name = duplicate_ssa_name (name, NULL); new_phi = create_phi_node (new_name, bb); SSA_NAME_DEF_STMT (new_name) = new_phi; - add_phi_arg (&new_phi, USE_FROM_PTR (op_p), exit); + add_phi_arg (&new_phi, name, exit); SET_USE (op_p, new_name); } } |