force_nonfallthru_and_redirect buglet
Jan Hubicka
jh@suse.cz
Thu Sep 20 02:58:00 GMT 2001
> On Wed, Sep 19, 2001 at 07:37:34PM +0200, Jan Hubicka wrote:
> > When exactly the FALLTHRU edge is created to the EXIT block at IA-64
> > compilation? I believe that at machines with HAVE_epilogue, all edges
> > to EXIT block nonfallthru, as EXIT instruction should be in the way.
>
> It happens here
>
> 600 if (note
> 601 && INTVAL (XEXP (note, 0)) < REG_BR_PROB_BASE / 2
> 602 && invert_jump (bb_end_insn,
> 603 label_for_bb (e_fall->dest), 0))
> 604 {
> 605 e_fall->flags &= ~EDGE_FALLTHRU;
> 606 e_taken->flags |= EDGE_FALLTHRU;
> 607 e = e_fall, e_fall = e_taken, e_taken = e;
> 608 }
>
> when we reverse the condition for
>
> (jump_insn 126 131 179 (set (pc)
> (if_then_else (eq (reg:BI 262 p6 [368])
> (const_int 0 [0x0]))
> (return)
> (pc))) 220 {*return_true}
> (expr_list:REG_DEAD (reg:BI 262 p6 [368])
> (expr_list:REG_BR_PROB (const_int 4500 [0x1194])
> (nil))))
>
> which seems a perfectly reasonable thing to do.
Uh, so the code attempts to put EXIT into the fallthru path?
I guess thats the problem. If I understant it, e_fall points somewhere,
while e_taken points to EXIT. The return is predicted as taken and the
code attempts to reverse the condition to make return fallthru...
funny idea :)
Does the attached patch help?
>
>
> r~
Thu Sep 20 11:57:53 CEST 2001 Jan Hubicka <jh@suse.cz>
* bb-reorder.c (fixup_reorder_chain): Avoid attempts to make predicted
condtional return an fallthru path.
Index: bb-reorder.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/bb-reorder.c,v
retrieving revision 1.39
diff -c -3 -p -r1.39 bb-reorder.c
*** bb-reorder.c 2001/09/16 20:21:23 1.39
--- bb-reorder.c 2001/09/20 09:57:48
*************** fixup_reorder_chain ()
*** 597,603 ****
if (RBI (bb)->next != e_taken->dest)
{
rtx note = find_reg_note (bb_end_insn, REG_BR_PROB, 0);
! if (note
&& INTVAL (XEXP (note, 0)) < REG_BR_PROB_BASE / 2
&& invert_jump (bb_end_insn,
label_for_bb (e_fall->dest), 0))
--- 597,603 ----
if (RBI (bb)->next != e_taken->dest)
{
rtx note = find_reg_note (bb_end_insn, REG_BR_PROB, 0);
! if (note && e_taken->dest != EXIT_BLOCK_PTR
&& INTVAL (XEXP (note, 0)) < REG_BR_PROB_BASE / 2
&& invert_jump (bb_end_insn,
label_for_bb (e_fall->dest), 0))
More information about the Gcc-patches
mailing list