Commit 4f7db7f7 by Kazu Hirata Committed by Kazu Hirata

tree-cfg.c (reinstall_phi_args): New.

	* tree-cfg.c (reinstall_phi_args): New.
	(tree_split_edge): Use it after redirecting an edge.  Don't
	modify PHI_ARG_EDGE.

From-SVN: r90940
parent 1d8a9009
2004-11-19 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (reinstall_phi_args): New.
(tree_split_edge): Use it after redirecting an edge. Don't
modify PHI_ARG_EDGE.
2004-11-19 Andreas Tobler <a.tobler@schweiz.ch> 2004-11-19 Andreas Tobler <a.tobler@schweiz.ch>
* tree-vectorizer.c (slpeel_verify_cfg_after_peeling): Define only * tree-vectorizer.c (slpeel_verify_cfg_after_peeling): Define only
......
...@@ -3113,6 +3113,31 @@ bsi_insert_on_edge_immediate (edge e, tree stmt) ...@@ -3113,6 +3113,31 @@ bsi_insert_on_edge_immediate (edge e, tree stmt)
Tree specific functions for CFG manipulation Tree specific functions for CFG manipulation
---------------------------------------------------------------------------*/ ---------------------------------------------------------------------------*/
/* Reinstall those PHI arguments queued in OLD_EDGE to NEW_EDGE. */
static void
reinstall_phi_args (edge new_edge, edge old_edge)
{
tree var, phi;
if (!PENDING_STMT (old_edge))
return;
for (var = PENDING_STMT (old_edge), phi = phi_nodes (new_edge->dest);
var && phi;
var = TREE_CHAIN (var), phi = PHI_CHAIN (phi))
{
tree result = TREE_PURPOSE (var);
tree arg = TREE_VALUE (var);
gcc_assert (result == PHI_RESULT (phi));
add_phi_arg (&phi, arg, new_edge);
}
PENDING_STMT (old_edge) = NULL;
}
/* Split a (typically critical) edge EDGE_IN. Return the new block. /* Split a (typically critical) edge EDGE_IN. Return the new block.
Abort on abnormal edges. */ Abort on abnormal edges. */
...@@ -3121,8 +3146,6 @@ tree_split_edge (edge edge_in) ...@@ -3121,8 +3146,6 @@ tree_split_edge (edge edge_in)
{ {
basic_block new_bb, after_bb, dest, src; basic_block new_bb, after_bb, dest, src;
edge new_edge, e; edge new_edge, e;
tree phi;
int i, num_elem;
edge_iterator ei; edge_iterator ei;
/* Abnormal edges cannot be split. */ /* Abnormal edges cannot be split. */
...@@ -3149,23 +3172,9 @@ tree_split_edge (edge edge_in) ...@@ -3149,23 +3172,9 @@ tree_split_edge (edge edge_in)
new_edge->probability = REG_BR_PROB_BASE; new_edge->probability = REG_BR_PROB_BASE;
new_edge->count = edge_in->count; new_edge->count = edge_in->count;
/* Find all the PHI arguments on the original edge, and change them to
the new edge. Do it before redirection, so that the argument does not
get removed. */
for (phi = phi_nodes (dest); phi; phi = PHI_CHAIN (phi))
{
num_elem = PHI_NUM_ARGS (phi);
for (i = 0; i < num_elem; i++)
if (PHI_ARG_EDGE (phi, i) == edge_in)
{
PHI_ARG_EDGE (phi, i) = new_edge;
break;
}
}
e = redirect_edge_and_branch (edge_in, new_bb); e = redirect_edge_and_branch (edge_in, new_bb);
gcc_assert (e); gcc_assert (e);
gcc_assert (!PENDING_STMT (edge_in)); reinstall_phi_args (new_edge, e);
return new_bb; return new_bb;
} }
......
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