This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-ssa] CALL_EXPR support for operand_equal_p


In message <wvl7k7ren6p.fsf@prospero.boston.redhat.com>, Jason Merrill writes:
 >On Thu, 12 Jun 2003 01:07:57 -0600, law@redhat.com wrote:
 >
 >> In message <wvlk7breq17.fsf@prospero.boston.redhat.com>, Jason Merrill writ
 >es:
 >>  >I would expect you to check for "const" in operand_equal_p; two calls wit
 >h
 >>  >side effects should not be considered equal.
 >> Ugh.  I thought the TREE_SIDE_EFFECTS test was in a more general
 >> location, not localized to the 'r' cases.
 >>
 >> Seems to me we need to be peeking at TREE_SIDE_EFFECTS in the call case
 >> (as opposed for checking for "const" directly)
 >
 >That works, too.

	* fold-const.c (operand_equal_p): CALL_EXPRs with side effects
	are never equal.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.213.2.31
diff -c -3 -p -r1.213.2.31 fold-const.c
*** fold-const.c	12 Jun 2003 04:47:06 -0000	1.213.2.31
--- fold-const.c	12 Jun 2003 16:40:12 -0000
*************** operand_equal_p (arg0, arg1, only_const)
*** 2017,2022 ****
--- 2017,2028 ----
  	  return rtx_equal_p (RTL_EXPR_RTL (arg0), RTL_EXPR_RTL (arg1));
  
  	case CALL_EXPR:
+ 
+ 	  /* If either CALL_EXPR has a side effect, then they can not
+ 	     be equal.  */
+ 	  if (TREE_SIDE_EFFECTS (arg0) || TREE_SIDE_EFFECTS (arg1))
+ 	    return 0;
+ 
  	  /* If the CALL_EXPRs call different functions, then they
  	     clearly can not be equal.  */
  	  if (! operand_equal_p (TREE_OPERAND (arg0, 0),



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]