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: RFA: redirect_jump_1: fix REG_EQUAL notes


redirect_jump_1 actually fails when it is called so that it will neither change the label
nor the mode. This is because validate_change doesn't register a change and thus also
doesn't increase the changes counter when the replacement is rtx_equal_p to the old value.
We have some code in set_edge_can_fallthru_flag that calls invert_jump to find out
if it can (couldn't it be using invert_jump_1 / cancel_changes instead?), and calls invert_jump
again if the first call succeeded, and relies on it succeeding. If it doesn't due to zero changes
in redirect_jump_1, we end up with inverted branch probabilities and an ICE in
verify_flow_info. The first call can succeed even with a defective inert_jump if the machine
description or some part of the expanders / optimizers have generated a VOIDmode LABEL_REF.
There still are quite a lot of places where this happens. I have therefore checked in the attached patch
as obvious.
2005-03-08  J"orn Rennecke <joern.rennecke@st.com>

	* jump.c (invert_jump_1): Don't call redirect_jump_1 with
	nlabel == JUMP_LABEL (jump).

Index: jump.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/jump.c,v
retrieving revision 1.256
diff -p -r1.256 jump.c
*** jump.c	5 Mar 2005 14:01:01 -0000	1.256
--- jump.c	8 Mar 2005 15:19:25 -0000
*************** invert_jump_1 (rtx jump, rtx nlabel)
*** 1716,1722 ****
    if (num_validated_changes () == ochanges)
      return 0;
  
!   return redirect_jump_1 (jump, nlabel);
  }
  
  /* Invert the condition of the jump JUMP, and make it jump to label
--- 1716,1724 ----
    if (num_validated_changes () == ochanges)
      return 0;
  
!   /* redirect_jump_1 will fail of nlabel == olabel, and the current use is
!      in Pmode, so checking this is not merely an optimization.  */
!   return nlabel == JUMP_LABEL (jump) || redirect_jump_1 (jump, nlabel);
  }
  
  /* Invert the condition of the jump JUMP, and make it jump to label

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