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]

[tree-ssa] fold_binary_nondestructive tweek


Hi,
I get another failure in RTL expansion because "test" + 10 + 2 never
gets folded into "test" + 12 that prevents later constant folding.
The reason is cast in a way.

2003-11-05  Jan Hubicka  <jh@suse.cz>
	* fold-const.c (nondestructive_fold_binary_to_constant): Deal
	with conversion.

Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.213.2.55
diff -c -3 -p -r1.213.2.55 fold-const.c
*** fold-const.c	30 Oct 2003 02:27:40 -0000	1.213.2.55
--- fold-const.c	5 Nov 2003 15:12:12 -0000
*************** nondestructive_fold_binary_to_constant (
*** 9029,9035 ****
        /* (plus (address) (const_int)) is a constant.  */
        if (TREE_CODE (op0) == PLUS_EXPR
  	  && TREE_CODE (op1) == INTEGER_CST
! 	  && TREE_CODE (TREE_OPERAND (op0, 0)) == ADDR_EXPR
  	  && TREE_CODE (TREE_OPERAND (op0, 1)) == INTEGER_CST)
  	{
            return build (PLUS_EXPR, type, TREE_OPERAND (op0, 0),
--- 9036,9045 ----
        /* (plus (address) (const_int)) is a constant.  */
        if (TREE_CODE (op0) == PLUS_EXPR
  	  && TREE_CODE (op1) == INTEGER_CST
! 	  && (TREE_CODE (TREE_OPERAND (op0, 0)) == ADDR_EXPR
! 	      || (TREE_CODE (TREE_OPERAND (op0, 0)) == NOP_EXPR
! 		  && (TREE_CODE (TREE_OPERAND (TREE_OPERAND (op0, 0), 0))
! 		      == NOP_EXPR)))
  	  && TREE_CODE (TREE_OPERAND (op0, 1)) == INTEGER_CST)
  	{
            return build (PLUS_EXPR, type, TREE_OPERAND (op0, 0),


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