[PATCH] ssa-ccp.c don't claim a node was set to a constant if it was already like that before the pass

Dan Nicolaescu dann@godzilla.ICS.UCI.EDU
Mon Aug 27 10:02:00 GMT 2001


when compiling

int
test (int a, int  b)
{
  if (a > b)
    return 1;
  else
    return 0;
}

with -O2 -fssa -fssa-ccp the .ssaccp dump file says:

Register 106 now set to a constant
Register 111 now set to a constant

Well, that was the case even before ssa-ccp, so we should avoid
invalidating the insn and running df in this case.

If it's OK please apply. I don't have write access.


Daniel: this is the same patch I sent you last night, just against mainline.


2001-08-26  Dan Nicolaescu  <dann@ics.uci.edu>

	* ssa-ccp.c (ssa_ccp_substitute_constants): Don't do anything if
	the node was already a set to a constant. 

*** ssa-ccp.c.~1.8.~	Mon Aug 27 09:56:49 2001
--- ssa-ccp.c	Mon Aug 27 09:57:36 2001
***************
*** 866,873 ****
  	  /* Do not try to simplify PHI nodes down to a constant load.
  	     That will be done later as we translate out of SSA.  Also,
  	     doing that here could violate the rule that all PHI nodes
! 	     are consecutive at the start of the basic block.  */
! 	  if (! PHI_NODE_P (def))
  	    {
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file,
--- 866,878 ----
  	  /* Do not try to simplify PHI nodes down to a constant load.
  	     That will be done later as we translate out of SSA.  Also,
  	     doing that here could violate the rule that all PHI nodes
! 	     are consecutive at the start of the basic block.
! 
! 	     Don't do anything to nodes that were already sets to
! 	     constants.	 */
! 	  if (! PHI_NODE_P (def)
! 	      && ! ((GET_CODE (def) == INSN
! 		     && GET_CODE (SET_SRC (set)) == CONST_INT)))
  	    {
  	      if (rtl_dump_file)
  		fprintf (rtl_dump_file,



More information about the Gcc-patches mailing list