summaryrefslogtreecommitdiff
path: root/gcc/tree-phinodes.c
diff options
context:
space:
mode:
authorkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-03 17:15:36 +0000
committerkazu <kazu@138bc75d-0d04-0410-961f-82ee72b054a4>2005-03-03 17:15:36 +0000
commit1e49fef24b822f1ff45f689c24638311e5b2c3c8 (patch)
tree5517a8eb77cadd3fcdff6ee626b6ecfd197173cd /gcc/tree-phinodes.c
parent1b7607f106955b19e806fedfb37105e30db59528 (diff)
downloadgcc-1e49fef24b822f1ff45f689c24638311e5b2c3c8.tar.gz
* tree-phinodes.c (remove_phi_node): Clean up by factoring out
calls to release_ssa_name and release_phi_node. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95835 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-phinodes.c')
-rw-r--r--gcc/tree-phinodes.c39
1 files changed, 15 insertions, 24 deletions
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 91bff61b1e0..a849d6ac791 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -404,36 +404,27 @@ remove_phi_args (edge e)
void
remove_phi_node (tree phi, tree prev, basic_block bb)
{
- if (prev)
- {
- /* Rewire the list if we are given a PREV pointer. */
- PHI_CHAIN (prev) = PHI_CHAIN (phi);
+ tree *loc;
- /* If we are deleting the PHI node, then we should release the
- SSA_NAME node so that it can be reused. */
- release_ssa_name (PHI_RESULT (phi));
- release_phi_node (phi);
- }
- else if (phi == phi_nodes (bb))
+ if (prev)
{
- /* Update the list head if removing the first element. */
- bb_ann (bb)->phi_nodes = PHI_CHAIN (phi);
-
- /* If we are deleting the PHI node, then we should release the
- SSA_NAME node so that it can be reused. */
- release_ssa_name (PHI_RESULT (phi));
- release_phi_node (phi);
+ loc = &PHI_CHAIN (prev);
}
else
{
- /* Traverse the list looking for the node to remove. */
- tree prev, t;
- prev = NULL_TREE;
- for (t = phi_nodes (bb); t && t != phi; t = PHI_CHAIN (t))
- prev = t;
- if (t)
- remove_phi_node (t, prev, bb);
+ for (loc = &(bb_ann (bb)->phi_nodes);
+ *loc != phi;
+ loc = &PHI_CHAIN (*loc))
+ ;
}
+
+ /* Remove PHI from the chain. */
+ *loc = PHI_CHAIN (phi);
+
+ /* If we are deleting the PHI node, then we should release the
+ SSA_NAME node so that it can be reused. */
+ release_ssa_name (PHI_RESULT (phi));
+ release_phi_node (phi);
}