Commit 7fac6722 by Zdenek Dvorak Committed by Zdenek Dvorak

tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname arguments of…

tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname arguments of the phi nodes correctly.

	* tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname
	arguments of the phi nodes correctly.

From-SVN: r87405
parent 85914593
2004-09-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname
arguments of the phi nodes correctly.
2004-09-12 Jan Hubicka <jh@suse.cz> 2004-09-12 Jan Hubicka <jh@suse.cz>
* ggc-common.c (cmp_statistics): Fix sorting. * ggc-common.c (cmp_statistics): Fix sorting.
......
...@@ -395,17 +395,26 @@ split_loop_exit_edge (edge exit) ...@@ -395,17 +395,26 @@ split_loop_exit_edge (edge exit)
{ {
basic_block dest = exit->dest; basic_block dest = exit->dest;
basic_block bb = loop_split_edge_with (exit, NULL); 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; use_operand_p op_p;
for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi)) for (phi = phi_nodes (dest); phi; phi = TREE_CHAIN (phi))
{ {
op_p = PHI_ARG_DEF_PTR_FROM_EDGE (phi, bb->succ); 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); new_phi = create_phi_node (new_name, bb);
SSA_NAME_DEF_STMT (new_name) = new_phi; 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); SET_USE (op_p, new_name);
} }
} }
......
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