Skip to content

Commit 9ab38fc

Browse files
authored
AMDGPU: Replace some uses of getOpRegClass with getRegClass (#167447)
These cases should not depend on an unknown register constraint.
1 parent 8eb28ca commit 9ab38fc

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

llvm/lib/Target/AMDGPU/SIISelLowering.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17367,12 +17367,14 @@ void SITargetLowering::AddMemOpInit(MachineInstr &MI) const {
1736717367
// Abandon attempt if the dst size isn't large enough
1736817368
// - this is in fact an error but this is picked up elsewhere and
1736917369
// reported correctly.
17370-
uint32_t DstSize =
17371-
TRI.getRegSizeInBits(*TII->getOpRegClass(MI, DstIdx)) / 32;
17370+
const TargetRegisterClass *DstRC = TII->getRegClass(MI.getDesc(), DstIdx);
17371+
17372+
uint32_t DstSize = TRI.getRegSizeInBits(*DstRC) / 32;
1737217373
if (DstSize < InitIdx)
1737317374
return;
1737417375
} else if (TII->isMUBUF(MI) && AMDGPU::getMUBUFTfe(MI.getOpcode())) {
17375-
InitIdx = TRI.getRegSizeInBits(*TII->getOpRegClass(MI, DstIdx)) / 32;
17376+
const TargetRegisterClass *DstRC = TII->getRegClass(MI.getDesc(), DstIdx);
17377+
InitIdx = TRI.getRegSizeInBits(*DstRC) / 32;
1737617378
} else {
1737717379
return;
1737817380
}

llvm/lib/Target/AMDGPU/SIRegisterInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3046,7 +3046,7 @@ bool SIRegisterInfo::eliminateFrameIndex(MachineBasicBlock::iterator MI,
30463046
if (!IsMUBUF && !MFI->isBottomOfStack()) {
30473047
// Convert to a swizzled stack address by scaling by the wave size.
30483048
// In an entry function/kernel the offset is already swizzled.
3049-
bool IsSALU = isSGPRClass(TII->getOpRegClass(*MI, FIOperandNum));
3049+
bool IsSALU = isSGPRClass(TII->getRegClass(MI->getDesc(), FIOperandNum));
30503050
bool LiveSCC = RS->isRegUsed(AMDGPU::SCC) &&
30513051
!MI->definesRegister(AMDGPU::SCC, /*TRI=*/nullptr);
30523052
const TargetRegisterClass *RC = IsSALU && !LiveSCC

0 commit comments

Comments
 (0)