replace_ssa_names abort that started last week

Jeffrey A Law law@redhat.com
Mon Jun 14 20:38:00 GMT 2004


On Wed, 2004-05-26 at 20:51, Bradley Lucier wrote:
> Jeff (and others);
> 
> PR 15643 began last week some time, which correlates when you were 
> making changes to the tree optimization code. There are short testcases 
> in C and Java that fail on multiple platforms; perhaps this could be 
> investigated while the problem is still fresh.
The underlying problem was that kill_redundant_phi_nodes was doing
copy propagation even though the result and/or an argument to a
PHI was marked with SSA_NAME_OCCURS_IN_ABNORMAL_PHI.  When the code
actually tried to do the replacements it aborted.

This patch fixes the problem by raising the destination of a PHI node
to the top of the lattice if the destination or any argument is
marked with SSA_NAME_OCCURS_IN_ABNORMAL_PHI.  Raising the value to the
top of the lattice prevents the problematical copy propagation.

Bootstrapped and regression tested on i686-pc-linux-gnu.




> 
> Brad
-------------- next part --------------
	* tree-ssa.c (kill_redundant_phi_nodes): More correctly handle
	PHIs where the destination or an argument is marked with
	SSA_NAME_OCCURS_IN_ABNORMAL_PHI.

Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
retrieving revision 2.7
diff -c -p -r2.7 tree-ssa.c
*** tree-ssa.c	10 Jun 2004 22:37:05 -0000	2.7
--- tree-ssa.c	14 Jun 2004 20:28:58 -0000
*************** kill_redundant_phi_nodes (void)
*** 885,890 ****
--- 885,898 ----
  	{
  	  var = PHI_RESULT (phi);
  
+ 	  /* If the destination of the PHI is associated with an
+ 	     abnormal edge, then we can not propagate this PHI away.  */
+ 	  if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (var))
+ 	    {
+ 	      raise_value (phi, var, eq_to);
+ 	      continue;
+ 	    }
+ 
  	  for (i = 0; i < (unsigned) PHI_NUM_ARGS (phi); i++)
  	    {
  	      t = PHI_ARG_DEF (phi, i);
*************** kill_redundant_phi_nodes (void)
*** 897,908 ****
  
  	      stmt = SSA_NAME_DEF_STMT (t);
  
  	      /* If the defining statement for this argument is not a
! 		 phi node or the argument is associated with an abnormal
! 		 edge, then we need to recursively start the forward
  		 dataflow starting with PHI.  */
! 	      if (TREE_CODE (stmt) != PHI_NODE
! 		  || SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
  		{
  		  eq_to[SSA_NAME_VERSION (t)] = t;
  		  raise_value (phi, t, eq_to);
--- 905,924 ----
  
  	      stmt = SSA_NAME_DEF_STMT (t);
  
+ 	      /* If any particular PHI argument is associated with
+ 		 an abnormal edge, then we know that we should not
+ 		 be propagating away this PHI.  Go ahead and raise
+ 		 the result of this PHI to the top of the lattice.  */
+ 	      if (SSA_NAME_OCCURS_IN_ABNORMAL_PHI (t))
+ 		{
+ 		  raise_value (phi, var, eq_to);
+ 		  continue;
+ 		}
+ 	      
  	      /* If the defining statement for this argument is not a
! 		 phi node then we need to recursively start the forward
  		 dataflow starting with PHI.  */
! 	      if (TREE_CODE (stmt) != PHI_NODE)
  		{
  		  eq_to[SSA_NAME_VERSION (t)] = t;
  		  raise_value (phi, t, eq_to);


More information about the Gcc mailing list