-
Notifications
You must be signed in to change notification settings - Fork 15k
[AArch64][SVE] Avoid extra pop of "FixedObject" with FPAfterSVECalleeSaves #156452
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…Saves Previously, we would pop `FixedObject`-bytes after deallocating the SVE area, then again as part of the "AfterCSRPopSize". This could be seen in the tests `@f6` and `@f9`. This patch removes the erroneous pop, and refactors `FPAfterSVECalleeSaves` to reuse more of the existing GPR deallocation logic, which allows for post-decrements.
// If not, and FPAfterSVECalleeSaves is enabled, deallocate callee-save | ||
// non-SVE registers to move the stack pointer to the start of the SVE | ||
// area. | ||
emitFrameOffset(MBB, std::next(Pop), DL, AArch64::SP, AArch64::SP, | ||
StackOffset::getFixed(ProloguePopSize), TII, | ||
MachineInstr::FrameDestroy, false, NeedsWinCFI, | ||
&HasWinCFI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been unable to come up with a reasonable test for this case. With !FPAfterSVECalleeSaves
we only get here if:
- We have hazard padding (not applicable)
- Or use some somewhat niche
swiftcc
ortailcc
functionality, which I'm not sure works with SVE.
I wonder if it'd be okay to just do if (FPAfterSVECalleeSaves) reportFatalInternalError(...)
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't be surprised if tailcc handling doesn't work with SVE argument/return types, but it shouldn't interact with SVE spill slots outside of this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic here makes sense.
// If not, and FPAfterSVECalleeSaves is enabled, deallocate callee-save | ||
// non-SVE registers to move the stack pointer to the start of the SVE | ||
// area. | ||
emitFrameOffset(MBB, std::next(Pop), DL, AArch64::SP, AArch64::SP, | ||
StackOffset::getFixed(ProloguePopSize), TII, | ||
MachineInstr::FrameDestroy, false, NeedsWinCFI, | ||
&HasWinCFI); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wouldn't be surprised if tailcc handling doesn't work with SVE argument/return types, but it shouldn't interact with SVE spill slots outside of this code.
Previously, we would pop
FixedObject
-bytes after deallocating the SVE area, then again as part of the "AfterCSRPopSize". This could be seen in the tests@f6
and@f9
.This patch removes the erroneous pop, and refactors
FPAfterSVECalleeSaves
to reuse more of the existing GPR deallocation logic, which allows for post-decrements.