-
Notifications
You must be signed in to change notification settings - Fork 15.3k
Open
Description
https://godbolt.org/z/9dj5eaxa9 shows a function with a mix of callee-saved registers, fixed size stack objects, and variable size stack objects where Clang's code generation is seemingly worse than GCC's:
- Clang requires two more callee-saved registers.
x19is presumably serving as the base pointer, perThere's no overaligned local variables here though, so I'm not sure why the base pointer is needed.llvm-project/llvm/lib/Target/AArch64/AArch64FrameLowering.cpp
Lines 83 to 84 in 3ff3c4e
// |-----------------------------------| <- bp(not defined by ABI, // |.variable-sized.local.variables....| LLVM chooses X19) x21seemingly serves no purpose: the stack pointer is copied to it in line 11, and then it's copied back to the stack pointer in line 22, but the copied value is immediately overridden two instructions later (line 24), so it's never used.
Is there potential to improve the frame setup here, or am I just missing something in what Clang is doing?