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: test patch for computed gotos


On Sun, Feb 09, 2003 at 06:46:06AM -0700, Roger Sayle wrote:
> I'm not familiar with indirect jumps, but I suspect that the only
> thing that may need to be changed is in bypass_conditional_jumps:
> 
>             else if (GET_CODE (insn) == JUMP_INSN)
>               {
>                 if (any_condjump_p (insn) && onlyjump_p (insn))
>                   changed |= bypass_block (bb, setcc, insn);
>                 break;
>               }
> 
> What do you think?

Nearly.  The following appears to work.


r~


Index: gcse.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gcse.c,v
retrieving revision 1.234
diff -c -p -d -u -r1.234 gcse.c
--- gcse.c	7 Feb 2003 22:57:41 -0000	1.234
+++ gcse.c	9 Feb 2003 20:41:14 -0000
@@ -4819,7 +4819,7 @@ bypass_block (bb, setcc, jump)
 	  if (new == pc_rtx)
 	    dest = FALLTHRU_EDGE (bb)->dest;
 	  else if (GET_CODE (new) == LABEL_REF)
-	    dest = BRANCH_EDGE (bb)->dest;
+	    dest = BLOCK_FOR_INSN (XEXP (new, 0));
 	  else
 	    dest = NULL;
 
@@ -4901,7 +4901,8 @@ bypass_conditional_jumps ()
 	      }
 	    else if (GET_CODE (insn) == JUMP_INSN)
 	      {
-		if (any_condjump_p (insn) && onlyjump_p (insn))
+		if ((any_condjump_p (insn) || computed_jump_p (insn))
+		    && onlyjump_p (insn))
 		  changed |= bypass_block (bb, setcc, insn);
 		break;
 	      }


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