[Bug middle-end/81445] Dynamic stack allocation not optimized into static allocation
wilco at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Jul 14 16:17:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81445
--- Comment #2 from Wilco <wilco at gcc dot gnu.org> ---
(In reply to Marc Glisse from comment #1)
> Note that we already do it for VLA (aka BUILT_IN_ALLOCA_WITH_ALIGN) in CCP.
I don't see it happen for the simplest case in current trunk:
void t(int *);
void vla(void)
{
int x = 100;
int arr[x];
t (arr);
}
void no_vla(void)
{
int arr[100];
t (arr);
}
vla:
stp x29, x30, [sp, -16]!
add x29, sp, 0
sub sp, sp, #416 // alloca
mov x0, sp
bl t
add sp, x29, 0
ldp x29, x30, [sp], 16
ret
no_vla:
stp x29, x30, [sp, -416]!
add x29, sp, 0
add x0, sp, 16
bl t
ldp x29, x30, [sp], 416
ret
More information about the Gcc-bugs
mailing list