Commit 40b554a3 by Steven Bosscher

tree-phinodes.c (remove_phi_arg_num): Don't remove PHIs without any PHI arguments left.

	* 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.

From-SVN: r89689
parent a559b61b
2004-10-27 Steven Bosscher <stevenb@suse.de>
* 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.
2004-10-27 Paul Brook <paul@codesourcery.com> 2004-10-27 Paul Brook <paul@codesourcery.com>
* configure.ac: Don't test for [build] __cxa_atexit when building a * configure.ac: Don't test for [build] __cxa_atexit when building a
......
...@@ -407,6 +407,8 @@ remove_phi_arg_num (tree phi, int i) ...@@ -407,6 +407,8 @@ remove_phi_arg_num (tree phi, int i)
{ {
int num_elem = PHI_NUM_ARGS (phi); int num_elem = PHI_NUM_ARGS (phi);
gcc_assert (i < num_elem);
/* If we are not at the last element, switch the last element /* If we are not at the last element, switch the last element
with the element we want to delete. */ with the element we want to delete. */
if (i != num_elem - 1) if (i != num_elem - 1)
...@@ -421,11 +423,6 @@ remove_phi_arg_num (tree phi, int i) ...@@ -421,11 +423,6 @@ remove_phi_arg_num (tree phi, int i)
PHI_ARG_EDGE (phi, num_elem - 1) = NULL; PHI_ARG_EDGE (phi, num_elem - 1) = NULL;
PHI_ARG_NONZERO (phi, num_elem - 1) = false; PHI_ARG_NONZERO (phi, num_elem - 1) = false;
PHI_NUM_ARGS (phi)--; 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 /* Remove PHI node PHI from basic block BB. If PREV is non-NULL, it is
......
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