summaryrefslogtreecommitdiff
path: root/gcc/tree-phinodes.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-29 00:48:00 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-29 00:48:00 +0000
commita803b0bd64298a3e1d5dd23af2ec0d06e7e886d5 (patch)
treef5dc21baf7048e92f9d09b17e5943c9ce39be886 /gcc/tree-phinodes.c
parentf0a62aab4d934f51ea5ca329db6d727a870f9d60 (diff)
downloadgcc-a803b0bd64298a3e1d5dd23af2ec0d06e7e886d5.tar.gz
* tree-phinodes.c (add_phi_arg): Turn an "if" that always
triggers into gcc_assert. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89800 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-phinodes.c')
-rw-r--r--gcc/tree-phinodes.c53
1 files changed, 26 insertions, 27 deletions
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index fdeb57a45a1..1cc613cc4af 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -321,42 +321,41 @@ add_phi_arg (tree *phi, tree def, edge e)
if (i >= PHI_ARG_CAPACITY (*phi))
{
tree old_phi = *phi;
+ basic_block bb;
- /* Resize the phi. Unfortunately, this may also relocate it. */
+ /* Resize the phi. Unfortunately, this will relocate it. */
resize_phi_node (phi, ideal_phi_node_len (i + 4));
+ /* resize_phi_node will necessarily relocate the phi. */
+ gcc_assert (*phi != old_phi);
+
/* The result of the phi is defined by this phi node. */
SSA_NAME_DEF_STMT (PHI_RESULT (*phi)) = *phi;
- /* If the PHI was relocated, update the PHI chains appropriately and
- release the old PHI node. */
- if (*phi != old_phi)
+ /* Extract the basic block for the PHI from the PHI's annotation
+ rather than the edge. This works better as the edge's
+ destination may not currently be the block with the PHI node
+ if we are in the process of threading the edge to a new
+ destination. */
+ bb = bb_for_stmt (*phi);
+
+ release_phi_node (old_phi);
+
+ /* Update the list head if replacing the first listed phi. */
+ if (phi_nodes (bb) == old_phi)
+ bb_ann (bb)->phi_nodes = *phi;
+ else
{
- /* Extract the basic block for the PHI from the PHI's annotation
- rather than the edge. This works better as the edge's
- destination may not currently be the block with the PHI
- node if we are in the process of threading the edge to
- a new destination. */
- basic_block bb = bb_for_stmt (*phi);
-
- release_phi_node (old_phi);
-
- /* Update the list head if replacing the first listed phi. */
- if (phi_nodes (bb) == old_phi)
- bb_ann (bb)->phi_nodes = *phi;
- else
- {
- /* Traverse the list looking for the phi node to chain to. */
- tree p;
+ /* Traverse the list looking for the phi node to chain to. */
+ tree p;
- for (p = phi_nodes (bb);
- p && PHI_CHAIN (p) != old_phi;
- p = PHI_CHAIN (p))
- ;
+ for (p = phi_nodes (bb);
+ p && PHI_CHAIN (p) != old_phi;
+ p = PHI_CHAIN (p))
+ ;
- gcc_assert (p);
- PHI_CHAIN (p) = *phi;
- }
+ gcc_assert (p);
+ PHI_CHAIN (p) = *phi;
}
}