summaryrefslogtreecommitdiff
path: root/gcc/tree-phinodes.c
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 17:14:19 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2004-10-27 17:14:19 +0000
commit13e517282c6f91daaa268d1485ccf1fe45350b24 (patch)
tree8f16e715609b1c7279583d2bb6a5fecbd287aad9 /gcc/tree-phinodes.c
parenta8def53ec758fac9d9a144577019c8993eaa9432 (diff)
downloadgcc-13e517282c6f91daaa268d1485ccf1fe45350b24.tar.gz
* tree-phinodes.c (remove_phi_arg_num): Don't remove PHIs
without any PHI arguments left. Make sure the argument that we're supposed to remove exists at all. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@89689 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-phinodes.c')
-rw-r--r--gcc/tree-phinodes.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gcc/tree-phinodes.c b/gcc/tree-phinodes.c
index 6dc5c7692de..64fab712a4d 100644
--- a/gcc/tree-phinodes.c
+++ b/gcc/tree-phinodes.c
@@ -407,6 +407,8 @@ remove_phi_arg_num (tree phi, int i)
{
int num_elem = PHI_NUM_ARGS (phi);
+ gcc_assert (i < num_elem);
+
/* If we are not at the last element, switch the last element
with the element we want to delete. */
if (i != num_elem - 1)
@@ -421,11 +423,6 @@ remove_phi_arg_num (tree phi, int i)
PHI_ARG_EDGE (phi, num_elem - 1) = NULL;
PHI_ARG_NONZERO (phi, num_elem - 1) = false;
PHI_NUM_ARGS (phi)--;
-
- /* If we removed the last PHI argument, then go ahead and
- remove the PHI node. */
- if (PHI_NUM_ARGS (phi) == 0)
- remove_phi_node (phi, NULL, bb_for_stmt (phi));
}
/* Remove PHI node PHI from basic block BB. If PREV is non-NULL, it is