Commit 641e7348 by Kazu Hirata Committed by Kazu Hirata

tree-ssa-threadupdate.c (copy_phis_to_block): Install PHI arguments using PENDING_STMT.

	* tree-ssa-threadupdate.c (copy_phis_to_block): Install PHI
	arguments using PENDING_STMT.
	(thread_block): Call copy_phis_to_block after redirecting an
	edge.

From-SVN: r89983
parent 7ef7b345
2004-11-02 Kazu Hirata <kazu@cs.umass.edu>
* tree-ssa-threadupdate.c (copy_phis_to_block): Install PHI
arguments using PENDING_STMT.
(thread_block): Call copy_phis_to_block after redirecting an
edge.
2004-11-02 Nathan Sidwell <nathan@codesourcery.com> 2004-11-02 Nathan Sidwell <nathan@codesourcery.com>
* bitmap.h (bitmap_and, bitmap_and_into, bitmap_and_compl, * bitmap.h (bitmap_and, bitmap_and_into, bitmap_and_compl,
......
...@@ -95,38 +95,37 @@ struct redirection_data ...@@ -95,38 +95,37 @@ struct redirection_data
/* Main data structure to hold information for duplicates of BB. */ /* Main data structure to hold information for duplicates of BB. */
static varray_type redirection_data; static varray_type redirection_data;
/* For each PHI node in BB, find or create a PHI node in NEW_BB for the /* Add to the destination of edge E those PHI arguments queued on
same PHI_RESULT. Add an argument to the PHI node in NEW_BB which E. */
corresponds to the same PHI argument associated with edge E in BB. */
static void static void
copy_phis_to_block (basic_block new_bb, basic_block bb, edge e) copy_phis_to_block (edge e)
{ {
tree phi, arg; basic_block dest = e->dest;
tree var;
/* Walk over every PHI in BB. */ for (var = PENDING_STMT (e); var; var = TREE_CHAIN (var))
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{ {
tree result = TREE_PURPOSE (var);
tree arg = TREE_VALUE (var);
tree new_phi; tree new_phi;
/* First try to find a PHI node in NEW_BB which has the same /* First try to find a PHI node in NEW_BB which has the same
PHI_RESULT as the PHI from BB we are currently processing. */ PHI_RESULT as the PHI from BB we are currently processing. */
for (new_phi = phi_nodes (new_bb); new_phi; for (new_phi = phi_nodes (dest); new_phi;
new_phi = PHI_CHAIN (new_phi)) new_phi = PHI_CHAIN (new_phi))
if (PHI_RESULT (new_phi) == PHI_RESULT (phi)) if (PHI_RESULT (new_phi) == result)
break; break;
/* If we did not find a suitable PHI in NEW_BB, create one. */ /* If we did not find a suitable PHI in NEW_BB, create one. */
if (!new_phi) if (!new_phi)
new_phi = create_phi_node (PHI_RESULT (phi), new_bb); new_phi = create_phi_node (result, dest);
/* Extract the argument corresponding to E from the current PHI
node in BB. */
arg = PHI_ARG_DEF_TREE (phi, phi_arg_from_edge (phi, e));
/* Now add that same argument to the new PHI node in block NEW_BB. */ /* Now add that same argument to the new PHI node in block NEW_BB. */
add_phi_arg (&new_phi, arg, e); add_phi_arg (&new_phi, arg, e);
} }
PENDING_STMT (e) = NULL;
} }
/* Remove the last statement in block BB if it is a control statement /* Remove the last statement in block BB if it is a control statement
...@@ -363,14 +362,13 @@ thread_block (basic_block bb) ...@@ -363,14 +362,13 @@ thread_block (basic_block bb)
if (rd->outgoing_edge == new_dest && rd->dup_block) if (rd->outgoing_edge == new_dest && rd->dup_block)
{ {
edge e2; edge e2;
copy_phis_to_block (rd->dup_block, bb, e);
if (dump_file && (dump_flags & TDF_DETAILS)) if (dump_file && (dump_flags & TDF_DETAILS))
fprintf (dump_file, " Threaded jump %d --> %d to %d\n", fprintf (dump_file, " Threaded jump %d --> %d to %d\n",
e->src->index, e->dest->index, rd->dup_block->index); e->src->index, e->dest->index, rd->dup_block->index);
e2 = redirect_edge_and_branch (e, rd->dup_block); e2 = redirect_edge_and_branch (e, rd->dup_block);
PENDING_STMT (e2) = NULL; copy_phis_to_block (e2);
if ((dump_file && (dump_flags & TDF_DETAILS)) if ((dump_file && (dump_flags & TDF_DETAILS))
&& e->src != e2->src) && e->src != e2->src)
......
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