fix rtl-opt/17186

Alan Modra amodra@bigpond.net.au
Mon Sep 13 12:35:00 GMT 2004


On Wed, Sep 08, 2004 at 12:34:11PM -0700, Richard Henderson wrote:
> Applied to mainline and 3.4.
> 
>         PR rtl-opt/17186
>         * function.c (expand_function_end): Have fall-off-the-end
>         return path jump around return register setup.

On 3.4, this breaks sibcalls, at least for powerpc64-linux.  A little
bit of debugging looking at gcc.dg/sibcall-1.c being compiled shows
that sibcalls.c:call_ends_block_p is returning zero.

At that point, the rtl for the end of the function looks like:

(note 67 32 54 5 [bb 5] NOTE_INSN_BASIC_BLOCK)

(call_insn 54 67 55 5 (call_placeholder 50 43 34 39 (call_insn 53 52 0 (parallel [
                (call (mem:SI (symbol_ref:DI ("recurser_void") [flags 0x3] <function_decl 0x80002fa5b0 recurser_void>) [0 S4 A8])
                    (const_int 64 [0x40]))
                (use (const_int 0 [0x0]))
                (clobber (scratch:SI))
            ]) -1 (nil)
        (nil)
        (expr_list (use (reg:DI 3 3))
            (nil)))) -1 (nil)
    (insn_list:REG_LABEL 39 (nil))
    (nil))

(note 55 54 56 5 0x80002f7690 NOTE_INSN_BLOCK_END)

(note 56 55 61 5 NOTE_INSN_FUNCTION_END)

(code_label 61 56 69 7 12 "" [1 uses])

(note 69 61 0 7 [bb 7] NOTE_INSN_BASIC_BLOCK)


call_ends_block_p is being called with "insn" pointing at the call, and
"end" pointing at note 56.  At the beginning of call_ends_block_p, we
have
   end = next_nonnote_insn (PREV_INSN (end));
which results in "end" being set to code_label 61.  Unfortunately,
call_ends_block_p seems to think that this label, which is the
naked_return_label, is somehow significant.  It looks to me like
the use count is wrong too.

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Gcc-patches mailing list