[Bug middle-end/81657] [8 Regression] FAIL: gcc.dg/20050503-1.c scan-assembler-not call

wilco at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Jan 18 17:57:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81657

Wilco <wilco at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wilco at gcc dot gnu.org

--- Comment #5 from Wilco <wilco at gcc dot gnu.org> ---
Note there are other optimizations which can block a tailcall, for example:

void *f (void *p) { return __builtin_strchr (p, 0); }

f:
        stp     x19, x30, [sp, -16]!
        mov     x19, x0
        bl      strlen
        add     x0, x19, x0
        ldp     x19, x30, [sp], 16
        ret

f:
        pushq   %rbx
        movq    %rdi, %rbx
        call    strlen
        addq    %rbx, %rax
        popq    %rbx
        ret


So the question is whether a tailcall is ever better than using a faster
library call.


More information about the Gcc-bugs mailing list