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]

[patch] cse.c: gcc_assertify an "if" statement whose condition isalways false.


Hi,

Attached is a patch to gcc_assertify an "if" statement whose condition
is always false.

AFAICT, all calls to fold_rtx have x != NULL_RTX.  This is a fairly
busy point where it is hit almost 31 million times during the
optimizing compilation of cc1-i files, so we should be as efficient as
possible here.

Tested on i686-pc-linux-gnu.  OK to apply?

Kazu Hirata

2005-01-26  Kazu Hirata  <kazu@cs.umass.edu>

	* cse.c (fold_rtx): gcc_assertify an "if" statement whose
	condition is always false.

Index: cse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cse.c,v
retrieving revision 1.332
diff -c -d -p -r1.332 cse.c
*** cse.c	26 Jan 2005 12:44:58 -0000	1.332
--- cse.c	26 Jan 2005 12:49:24 -0000
*************** fold_rtx (rtx x, rtx insn)
*** 3239,3246 ****
       extends.  */
    enum machine_mode mode_arg0;
  
!   if (x == 0)
!     return x;
  
    mode = GET_MODE (x);
    code = GET_CODE (x);
--- 3239,3247 ----
       extends.  */
    enum machine_mode mode_arg0;
  
! #ifdef ENABLE_CHECKING
!   gcc_assert (x != NULL_RTX);
! #endif
  
    mode = GET_MODE (x);
    code = GET_CODE (x);


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