This is the mail archive of the gcc-bugs@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]

[Bug optimization/14312] New: [tree-ssa regression] tailcalls not being generated when functions contain pointers


The attached function no-longer generates tail calls in tree-ssa.  This is a
regression from 3.5.0 (the problem seems to be some intermediate variables that
are created by earlier passes and which are marked non-static, addressable).

Compile the attached code with

  arm-elf-gcc -O2 -S test.c


void bar(int i);
void baz(int *);
void foo(int *x) { if (*x < 0) { baz (x); return; } bar(*x);
}

observe that the resulting code is 

foo:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {fp, ip, lr, pc}
        ldr     r3, [r0, #0]
        cmp     r3, #0
        sub     fp, ip, #4
        blt     .L5
        mov     r0, r3
        bl      bar
        ldmfd   sp, {fp, sp, pc}
.L5:
        bl      baz
        ldmfd   sp, {fp, sp, pc}

when it should be
        ldr     r3, [r0, #0]
        cmp     r3, #0
        @ lr needed for prologue
        blt     .L4
        mov     r0, r3
        b       bar
.L4:
        b       baz

-- 
           Summary: [tree-ssa regression] tailcalls not being generated when
                    functions contain pointers
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Keywords: pessimizes-code
          Severity: normal
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rearnsha at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: arm-elf


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14312


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