Skip to content

Commit 3f3c575

Browse files
committed
address comment
1 parent 45c8fe1 commit 3f3c575

File tree

2 files changed

+5
-19
lines changed

2 files changed

+5
-19
lines changed

llvm/lib/Target/AMDGPU/SIInsertWaitcnts.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -751,26 +751,25 @@ RegInterval WaitcntBrackets::getRegInterval(const MachineInstr *MI,
751751
MCRegister MCReg = AMDGPU::getMCReg(Op.getReg(), *ST);
752752
unsigned RegIdx = TRI->getHWRegIndex(MCReg);
753753
assert(isUInt<8>(RegIdx));
754-
unsigned Reg = (RegIdx << 1) | (AMDGPU::isHi16Reg(MCReg, *TRI) ? 1 : 0);
755754

756755
const TargetRegisterClass *RC = TRI->getPhysRegBaseClass(Op.getReg());
757756
unsigned Size = TRI->getRegSizeInBits(*RC);
758757

759758
// AGPRs/VGPRs are tracked every 16 bits, SGPRs by 32 bits
760759
if (TRI->isVectorRegister(*MRI, Op.getReg())) {
761-
assert(Reg <= SQ_MAX_PGM_VGPRS);
760+
unsigned Reg = (RegIdx << 1) | (AMDGPU::isHi16Reg(MCReg, *TRI) ? 1 : 0);
761+
assert(Reg <= AGPR_OFFSET);
762762
Result.first = Reg;
763763
if (TRI->isAGPR(*MRI, Op.getReg()))
764764
Result.first += AGPR_OFFSET;
765765
assert(Result.first >= 0 && Result.first < SQ_MAX_PGM_VGPRS);
766766
assert(Size % 16 == 0);
767767
Result.second = Result.first + (Size / 16);
768-
} else if (TRI->isSGPRReg(*MRI, Op.getReg()) &&
769-
(Reg >> 1) < SQ_MAX_PGM_SGPRS) {
768+
} else if (TRI->isSGPRReg(*MRI, Op.getReg()) && RegIdx < SQ_MAX_PGM_SGPRS) {
770769
// SGPRs including VCC, TTMPs and EXEC but excluding read-only scalar
771770
// sources like SRC_PRIVATE_BASE.
772-
Result.first = (Reg >> 1) + NUM_ALL_VGPRS;
773-
Result.second = Result.first + ((Size + 16) / 32);
771+
Result.first = RegIdx + NUM_ALL_VGPRS;
772+
Result.second = Result.first + divideCeil(Size, 32);
774773
} else {
775774
return {-1, -1};
776775
}

llvm/lib/Target/AMDGPU/SIRegisterInfo.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -295,21 +295,8 @@ class SIRegisterInfo final : public AMDGPUGenRegisterInfo {
295295
getRegClassForOperandReg(const MachineRegisterInfo &MRI,
296296
const MachineOperand &MO) const;
297297

298-
bool isVGPR(MCRegister Reg) const {
299-
const TargetRegisterClass *RC = getPhysRegBaseClass(Reg);
300-
// Registers without classes are unaddressable, SGPR-like registers.
301-
return RC && isVGPRClass(RC);
302-
}
303298
bool isVGPR(const MachineRegisterInfo &MRI, Register Reg) const;
304-
bool isAGPR(MCRegister Reg) const {
305-
const TargetRegisterClass *RC = getPhysRegBaseClass(Reg);
306-
// Registers without classes are unaddressable, SGPR-like registers.
307-
return RC && isAGPRClass(RC);
308-
}
309299
bool isAGPR(const MachineRegisterInfo &MRI, Register Reg) const;
310-
bool isVectorRegister(MCRegister Reg) const {
311-
return isVGPR(Reg) || isAGPR(Reg);
312-
}
313300
bool isVectorRegister(const MachineRegisterInfo &MRI, Register Reg) const {
314301
return isVGPR(MRI, Reg) || isAGPR(MRI, Reg);
315302
}

0 commit comments

Comments
 (0)