-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Description
The prolog for Win ARM64 functions allocates stacks for the parameter home area and locals with a single SUB. While this sometimes results in 1 less instruction in the prolog, it does prevent taking advantage of the packed unwind data format.
For example, for this test case:
extern void bar(int*);
int foo(int x)
{
int z;
bar(&z);
return x+z;
}
LLVM emits this prolog:
sub sp,sp,#0x20
str x19,[sp,#0x10]
str lr,[sp,#0x18]
This results in an unpacked unwind info record.
Emitting this prolog instead:
sub sp,sp,#0x10
stp x19,lr,[sp]
sub sp,sp,#0x10
Would allow to take advantage of the packed unwind data format according to https://learn.microsoft.com/en-us/cpp/build/arm64-exception-handling
Using packed records reduce the size of the unwind information in rdata significantly and improves the speed of stack walking.