Repository navigation
[AMDGPU] Make getNumSubRegsForSpillOp externally available (NFC). - #174997
Open
cdevadas wants to merge 4 commits into
Conversation
Contributor
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Jan 8, 2026
cdevadas
marked this pull request as ready for review
January 8, 2026 15:44
Member
|
@llvm/pr-subscribers-backend-amdgpu Author: Christudasan Devadasan (cdevadas) Changes2 Files Affected:
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
index 770ba41933efd..c45f5ccc10ccd 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp
@@ -1124,8 +1124,8 @@ SIRegisterInfo::getCrossCopyRegClass(const TargetRegisterClass *RC) const {
return RC == &AMDGPU::SCC_CLASSRegClass ? &AMDGPU::SReg_32RegClass : RC;
}
-static unsigned getNumSubRegsForSpillOp(const MachineInstr &MI,
- const SIInstrInfo *TII) {
+unsigned SIRegisterInfo::getNumSubRegsForSpillOp(const MachineInstr &MI) const {
+ const SIInstrInfo *TII = ST.getInstrInfo();
unsigned Op = MI.getOpcode();
switch (Op) {
@@ -2462,7 +2462,7 @@ bool SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
*MBB, MI, DL, Opc, Index, VData->getReg(), VData->isKill(), FrameReg,
TII->getNamedOperand(*MI, AMDGPU::OpName::offset)->getImm(),
*MI->memoperands_begin(), RS);
- MFI->addToSpilledVGPRs(getNumSubRegsForSpillOp(*MI, TII));
+ MFI->addToSpilledVGPRs(getNumSubRegsForSpillOp(*MI));
if (IsWWMRegSpill)
TII->restoreExec(*MF, *MBB, MI, DL, MFI->getSGPRForEXECCopy());
diff --git a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
index 2e2916f68f584..b959fe7cf2db1 100644
--- a/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
+++ b/llvm/lib/Target/AMDGPU/SIRegisterInfo.h
@@ -164,6 +164,8 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
const TargetRegisterClass *
getCrossCopyRegClass(const TargetRegisterClass *RC) const override;
+ unsigned getNumSubRegsForSpillOp(const MachineInstr &MI) const;
+
const TargetRegisterClass *
getRegClassForBlockOp(const MachineFunction &MF) const {
return &AMDGPU::VReg_1024RegClass;
|
arsenm
reviewed
Jan 8, 2026
cdevadas
force-pushed
the
users/cdevadas/add-spill-offset-to-sgpr-spill-pseudos
branch
from
January 12, 2026 13:29
da3d4c3 to
82cd3bf
Compare
cdevadas
force-pushed
the
users/cdevadas/make-getNumSubRegsForSpillOp-member-function
branch
from
January 12, 2026 13:29
089bb8e to
4142195
Compare
cdevadas
force-pushed
the
users/cdevadas/add-spill-offset-to-sgpr-spill-pseudos
branch
from
January 12, 2026 15:29
82cd3bf to
bde17ca
Compare
cdevadas
force-pushed
the
users/cdevadas/make-getNumSubRegsForSpillOp-member-function
branch
from
January 12, 2026 15:29
4142195 to
2750ee4
Compare
cdevadas
force-pushed
the
users/cdevadas/add-spill-offset-to-sgpr-spill-pseudos
branch
from
January 13, 2026 05:07
bde17ca to
1ba3503
Compare
cdevadas
force-pushed
the
users/cdevadas/make-getNumSubRegsForSpillOp-member-function
branch
from
January 13, 2026 05:07
2750ee4 to
144d8a2
Compare
arsenm
approved these changes
Jan 13, 2026
easyonaadit
force-pushed
the
users/cdevadas/add-spill-offset-to-sgpr-spill-pseudos
branch
from
July 31, 2026 09:20
1ba3503 to
e656f30
Compare
easyonaadit
force-pushed
the
users/cdevadas/make-getNumSubRegsForSpillOp-member-function
branch
from
July 31, 2026 09:20
144d8a2 to
836607c
Compare
🐧 Linux x64 Test Results
✅ The build succeeded and all tests passed. |
arsenm
reviewed
Jul 31, 2026
easyonaadit
force-pushed
the
users/cdevadas/make-getNumSubRegsForSpillOp-member-function
branch
from
September 29, 2026 13:01
836607c to
b2dc44e
Compare
easyonaadit
force-pushed
the
users/cdevadas/add-spill-offset-to-sgpr-spill-pseudos
branch
from
September 29, 2026 13:01
e656f30 to
8159478
Compare
arsenm
reviewed
Sep 30, 2026
Comment on lines
+6484
to
+6488
| // FIXME: This assumes the mask is statically known and not computed at | ||
| // runtime. However, some ABIs may want to compute the mask dynamically and | ||
| // this will need to be updated. | ||
| return llvm::popcount( | ||
| (uint64_t)getNamedOperand(MI, AMDGPU::OpName::mask)->getImm()); |
Contributor
There was a problem hiding this comment.
I'm not sure what practical use this case would be. Maybe just make this llvm_unreachable?
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

No description provided.