-
Notifications
You must be signed in to change notification settings - Fork 14.6k
[AArch64][SME2] Extend getRegAllocationHints for ZPRStridedOrContiguousReg #119865
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
Merged
kmclaughlin-arm
merged 6 commits into
llvm:main
from
kmclaughlin-arm:sme2-svecc-regalloc-hints
Dec 19, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8f466f8
Add SME2 dot tests using the SVE calling convention
kmclaughlin-arm 53e6242
[AArch64][SME2] Extend getRegAllocationHints for ZPRStridedOrContiguo…
kmclaughlin-arm b49fa70
- Replaced HintStrided with any_of
kmclaughlin-arm 1ac1992
- Replace uses of undef with poison in sme2 dot intrinsic tests
kmclaughlin-arm 70b5317
- Combine if conditions in getRegAllocationHints
kmclaughlin-arm 52f2bd3
- Reword comments in getRegAllocationHints
kmclaughlin-arm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1099,6 +1099,38 @@ bool AArch64RegisterInfo::getRegAllocationHints( | |||||||||||||||
const VirtRegMap *VRM, const LiveRegMatrix *Matrix) const { | ||||||||||||||||
const MachineRegisterInfo &MRI = MF.getRegInfo(); | ||||||||||||||||
|
||||||||||||||||
// Since the SVE calling convention preserves registers Z8-Z23, there are no | ||||||||||||||||
// ZPR2Strided or ZPR4Strided registers which do not overlap with the | ||||||||||||||||
// callee-saved registers. These will be pushed to the back of the allocation | ||||||||||||||||
// order for the ZPRStridedOrContiguous classes. | ||||||||||||||||
// However, if any of the instructions which define VirtReg are | ||||||||||||||||
// ZPRStridedOrContiguous registers used by a FORM_TRANSPOSED_REG_TUPLE | ||||||||||||||||
// pseudo, it will likely be better to try assigning a strided register | ||||||||||||||||
// anyway to avoid extra copy instructions. | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit:
Suggested change
(+clang-format) |
||||||||||||||||
unsigned RegID = MRI.getRegClass(VirtReg)->getID(); | ||||||||||||||||
// Look through uses of the register for FORM_TRANSPOSED_REG_TUPLE. | ||||||||||||||||
if ((RegID == AArch64::ZPR2StridedOrContiguousRegClassID || | ||||||||||||||||
RegID == AArch64::ZPR4StridedOrContiguousRegClassID) && | ||||||||||||||||
any_of(MRI.use_nodbg_instructions(VirtReg), [](const MachineInstr &Use) { | ||||||||||||||||
return Use.getOpcode() == | ||||||||||||||||
AArch64::FORM_TRANSPOSED_REG_TUPLE_X2_PSEUDO || | ||||||||||||||||
Use.getOpcode() == AArch64::FORM_TRANSPOSED_REG_TUPLE_X4_PSEUDO; | ||||||||||||||||
})) { | ||||||||||||||||
// Push the list of 2/4 ZPRStrided registers to Hints to ensure we try to | ||||||||||||||||
// allocate these first. | ||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: can be removed, since this is covered by the comment above. |
||||||||||||||||
const TargetRegisterClass *StridedRC = | ||||||||||||||||
RegID == AArch64::ZPR2StridedOrContiguousRegClassID | ||||||||||||||||
? &AArch64::ZPR2StridedRegClass | ||||||||||||||||
: &AArch64::ZPR4StridedRegClass; | ||||||||||||||||
|
||||||||||||||||
for (MCPhysReg Reg : Order) | ||||||||||||||||
if (StridedRC->contains(Reg)) | ||||||||||||||||
Hints.push_back(Reg); | ||||||||||||||||
|
||||||||||||||||
return TargetRegisterInfo::getRegAllocationHints(VirtReg, Order, Hints, MF, | ||||||||||||||||
VRM); | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
for (MachineInstr &MI : MRI.def_instructions(VirtReg)) { | ||||||||||||||||
if (MI.getOpcode() != AArch64::FORM_TRANSPOSED_REG_TUPLE_X2_PSEUDO && | ||||||||||||||||
MI.getOpcode() != AArch64::FORM_TRANSPOSED_REG_TUPLE_X4_PSEUDO) | ||||||||||||||||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
nit: