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]

[Committed] Re: [PATCH] Follow-up to PR middle-end/13392


It looks like whilst I was writing my version of Jakub's patch,
I misread the original code and consistently but incorrectly used
XEXP (ref, 1) to extract the CODE_LABEL from a LABEL_REF.  Thanks
to Graham for spotting this, the correct idiom is XEXP (ref, 0).

I've applied the patch below as obvious, after bootstrapping and
regression testing on i686-pc-linux-gnu with no new failures.
I'll also check this fix into the 3.4 branch once the regression
tests have finished without problems there.

My apologies.



2004-01-17  Roger Sayle  <roger@eyesopen.com>

	* builtins.c (expand_builtin_expect_jump): Fix mistake in my
	last patch.  Use XEXP (x, 0) to get a LABEL_REF's CODE_LABEL.


Index: builtins.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/builtins.c,v
retrieving revision 1.275
diff -c -3 -p -r1.275 builtins.c
*** builtins.c	15 Jan 2004 07:25:21 -0000	1.275
--- builtins.c	17 Jan 2004 18:31:30 -0000
*************** expand_builtin_expect_jump (tree exp, rt
*** 4492,4507 ****

  	      /* First check if we recognize any of the labels.  */
  	      if (GET_CODE (then_dest) == LABEL_REF
! 		  && XEXP (then_dest, 1) == if_true_label)
  		taken = 1;
  	      else if (GET_CODE (then_dest) == LABEL_REF
! 		       && XEXP (then_dest, 1) == if_false_label)
  		taken = 0;
  	      else if (GET_CODE (else_dest) == LABEL_REF
! 		       && XEXP (else_dest, 1) == if_false_label)
  		taken = 1;
  	      else if (GET_CODE (else_dest) == LABEL_REF
! 		       && XEXP (else_dest, 1) == if_true_label)
  		taken = 0;
  	      /* Otherwise check where we drop through.  */
  	      else if (else_dest == pc_rtx)
--- 4492,4507 ----

  	      /* First check if we recognize any of the labels.  */
  	      if (GET_CODE (then_dest) == LABEL_REF
! 		  && XEXP (then_dest, 0) == if_true_label)
  		taken = 1;
  	      else if (GET_CODE (then_dest) == LABEL_REF
! 		       && XEXP (then_dest, 0) == if_false_label)
  		taken = 0;
  	      else if (GET_CODE (else_dest) == LABEL_REF
! 		       && XEXP (else_dest, 0) == if_false_label)
  		taken = 1;
  	      else if (GET_CODE (else_dest) == LABEL_REF
! 		       && XEXP (else_dest, 0) == if_true_label)
  		taken = 0;
  	      /* Otherwise check where we drop through.  */
  	      else if (else_dest == pc_rtx)
*************** expand_builtin_expect_jump (tree exp, rt
*** 4511,4517 ****

  		  if (next && GET_CODE (next) == JUMP_INSN
  		      && any_uncondjump_p (next))
! 		    next = XEXP (SET_SRC (pc_set (next)), 1);

  		  /* NEXT is either a CODE_LABEL, NULL_RTX or something
  		     else that can't possibly match either target label.  */
--- 4511,4517 ----

  		  if (next && GET_CODE (next) == JUMP_INSN
  		      && any_uncondjump_p (next))
! 		    next = XEXP (SET_SRC (pc_set (next)), 0);

  		  /* NEXT is either a CODE_LABEL, NULL_RTX or something
  		     else that can't possibly match either target label.  */
*************** expand_builtin_expect_jump (tree exp, rt
*** 4527,4533 ****

  		  if (next && GET_CODE (next) == JUMP_INSN
  		      && any_uncondjump_p (next))
! 		    next = XEXP (SET_SRC (pc_set (next)), 1);

  		  if (next == if_false_label)
  		    taken = 0;
--- 4527,4533 ----

  		  if (next && GET_CODE (next) == JUMP_INSN
  		      && any_uncondjump_p (next))
! 		    next = XEXP (SET_SRC (pc_set (next)), 0);

  		  if (next == if_false_label)
  		    taken = 0;


Roger
--
Roger Sayle,                         E-mail: roger@eyesopen.com
OpenEye Scientific Software,         WWW: http://www.eyesopen.com/
Suite 1107, 3600 Cerrillos Road,     Tel: (+1) 505-473-7385
Santa Fe, New Mexico, 87507.         Fax: (+1) 505-473-0833


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