[llvm] [AMDGPU] Restore SP from saved-FP or saved-BP (PR #124007)
Christudasan Devadasan via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 23 22:06:33 PST 2025
cdevadas wrote:
> Another optimization opportunity: BP is only really needed if you have _both_ dynamic stack realignment and variable-sized objects. Otherwise there is at most one alignment gap and you can use FP/SP to access objects before/after the gap.
This patch is aimed to change the way we unwind the stack at the epilogue for various cases. If the stack size is known statically, `SP = SP - FixedStackSize` would suffice. But that's not the case always. BP is enforced with this patch, when there is a dyn stack bump from the original stack base (either due to dyn_stack_alloc or dyn_realignment), mainly to unwind the SP correctly at the epilogue. Otherwise, your point holds ("you can use FP/SP to access objects before/after the gap.") and we don't need BP when there are no fixed objects from the caller.
https://github.com/llvm/llvm-project/pull/124007
More information about the llvm-commits
mailing list