This is the mail archive of the gcc@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]

Re: -fssa-dce fails on HAVE_cc0 port?


apl@alum.mit.edu writes:

> It looks like we're deleting CC0 setters in the SSA passes.  This
> results in the compiler crashing in cse when fold_rtx stumbles over
> the fact that nobody set the cc0 value that's being tested for a
> conditional branch.
> 
> If this is news to the SSA developers, I can see about providing a test
> case.
> 
> I stumbled on this by asserting
> 
>   -Os -fssa -fssa-dce
> 
> to the port I'm doing.  I don't know if this will cause any released
> ports to crash or not.

I have sended a bugfix few weeks ago few times.
But my patch was ignored. :(
I don't know why.


diff -c3p /root/d/Work/src/gcc/dce.c /root/d/cvs/egcs/gcc/dce.c
*** /root/d/Work/src/gcc/dce.c	Sun Jun  3 15:26:48 2001
--- /root/d/cvs/egcs/gcc/dce.c	Mon Jul  2 19:55:45 2001
***************
*** 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]