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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note GCC knows main can only be called once (calling main more than once in
C/C++ is undefined IIRC) which is why this heuristic is there.

If you change the name from main to say ff, then the function gets inlined as
you wanted it to be.

_Z2ffv:
.LFB103:
        .cfi_startproc
        .cfi_personality 0x9b,DW.ref.__gxx_personality_v0
        .cfi_lsda 0x1b,.LLSDA103
        stp     x29, x30, [sp, -32]!
        .cfi_def_cfa_offset 32
        .cfi_offset 29, -32
        .cfi_offset 30, -24
        adrp    x0, .LC0
        add     x0, x0, :lo12:.LC0
        add     x29, sp, 0
        .cfi_def_cfa_register 29
        str     x19, [sp, 16]
        .cfi_offset 19, -16
.LEHB3:
        bl      puts
.LEHE3:
        adrp    x0, .LC1
        add     x0, x0, :lo12:.LC1
.LEHB4:
        bl      puts
.LEHE4:
        adrp    x19, .LC2
        add     x19, x19, :lo12:.LC2
        mov     x0, x19
        bl      puts
        mov     x0, x19
        bl      puts
        mov     w0, 0
        ldr     x19, [sp, 16]
        ldp     x29, x30, [sp], 32

Reply via email to