https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70044
Bug ID: 70044
Summary: [5/6 Regression] -flto turns on -fomit-frame-pointer
Product: gcc
Version: 6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: ktkachov at gcc dot gnu.org
CC: hubicka at gcc dot gnu.org
Target Milestone: ---
Target: aarch64
After r218767 (an LTO ICE fix from what I can tell) gcc started assuming
-fomit-frame-pointer on aarch64 during -flto.
Testcase:
int main(int argc, char **argv)
{
return atoi(argv[0]) + 1;
}
Compiled with -O0 -flto -save-temps
and looking at the ltrans0.s file:
main:
str x30, [sp, -32]!
str w0, [sp, 28]
str x1, [sp, 16]
ldr x0, [sp, 16]
ldr x0, [x0]
bl atoi
add w0, w0, 1
ldr x30, [sp], 32
ret
the frame pointer (x29) is not being pushed.
Before this changes we emit:
main:
stp x29, x30, [sp, -32]!
add x29, sp, 0
str w0, [x29, 28]
str x1, [x29, 16]
ldr x0, [x29, 16]
ldr x0, [x0]
bl atoi
add w0, w0, 1
ldp x29, x30, [sp], 32
ret
If I add a debug print of flat_omit_frame_pointer somewhere in the backend I
see that it becomes set to 1 during the final compilation with that revision,
whereas it remains 0 throughout the compilation before that revision