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]

dce bugfix for targets with CC0



The dead-code elimination pass removes a compare insns needed for
conditional jump insns.
IMHO: following patch can be applied to the 3.0 branch.


Sat Apr 14 20:38:42 2001  Denis Chertykov  <denisc@overta.ru>

	* dce.c: (Copyright): Add 2001.
	(eliminate_dead_code): Formatting, handle cc0_rtx for
	compare/jump_insn pairs. 


Index: dce.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/dce.c,v
retrieving revision 1.3
diff -c -3 -p -r1.3 dce.c
*** dce.c	2000/11/14 09:58:40	1.3
--- dce.c	2001/04/14 16:41:42
***************
*** 1,5 ****
  /* Dead-code elimination pass for the GNU compiler.
!    Copyright (C) 2000 Free Software Foundation, Inc.
     Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
  
  This file is part of GNU CC.
--- 1,5 ----
  /* Dead-code elimination pass for the GNU compiler.
!    Copyright (C) 2000, 2001 Free Software Foundation, Inc.
     Written by Jeffrey D. Oldham <oldham@codesourcery.com>.
  
  This file is part of GNU CC.
*************** eliminate_dead_code ()
*** 544,554 ****
  	    (cdbte, current_instruction, edge_number,
  	    {
  	      rtx jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end;
! 	      if (GET_CODE (jump_insn) == JUMP_INSN &&
! 		  UNNECESSARY_P (jump_insn)) {
! 		RESURRECT_INSN (jump_insn);
! 		VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn);
! 	      }
  	    });
  
  	  /* Propagate through the operands.  */
--- 544,555 ----
  	    (cdbte, current_instruction, edge_number,
  	    {
  	      rtx jump_insn = (INDEX_EDGE_PRED_BB (el, edge_number))->end;
! 	      if (GET_CODE (jump_insn) == JUMP_INSN
! 		  && UNNECESSARY_P (jump_insn))
! 		{
! 		  RESURRECT_INSN (jump_insn);
! 		  VARRAY_PUSH_RTX (unprocessed_instructions, jump_insn);
! 		}
  	    });
  
  	  /* Propagate through the operands.  */
*************** eliminate_dead_code ()
*** 556,561 ****
--- 557,576 ----
  			&propagate_necessity_through_operand,
  			(PTR) &unprocessed_instructions);
  
+ #ifdef HAVE_cc0
+ 	  if (reg_referenced_p (cc0_rtx, PATTERN (current_instruction)))
+ 	    {
+ 	      rtx prev = prev_nonnote_insn (current_instruction);
+ 	      /* We assume that at this stage CC's are always set explicitly
+ 		 and always immediately before the jump that will use them.  */
+ 	      if (prev && GET_CODE (prev) == INSN
+ 		  && sets_cc0_p (PATTERN (prev)))
+ 		{
+ 		  RESURRECT_INSN (prev);
+ 		  VARRAY_PUSH_RTX (unprocessed_instructions, prev);
+ 		}
+ 	    }
+ #endif /* HAVE_cc0 */
  	}
      }
  



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