Skip to content

Commit a2cab89

Browse files
committed
address comment
1 parent 5445432 commit a2cab89

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7245,15 +7245,16 @@ void SIInstrInfo::legalizeOperandsVALUt16(MachineInstr &MI,
72457245
unsigned OpIdx = Op.getOperandNo();
72467246
if (!OpIdx)
72477247
continue;
7248-
if (Op.isReg() && Op.getReg().isVirtual() && RI.isVGPR(MRI, Op.getReg())) {
7249-
unsigned RCID = get(Opcode).operands()[OpIdx].RegClass;
7250-
const TargetRegisterClass *ExpectedRC = RI.getRegClass(RCID);
7248+
if (Op.isReg() && Op.getReg().isVirtual()) {
72517249
const TargetRegisterClass *RC = MRI.getRegClass(Op.getReg());
7252-
if (32 == RI.getRegSizeInBits(*RC) &&
7253-
16 == RI.getRegSizeInBits(*ExpectedRC)) {
7250+
if (!RI.isVGPRClass(RC))
7251+
continue;
7252+
unsigned RCID = get(Opcode).operands()[OpIdx].RegClass;
7253+
unsigned expectedSize = RI.getRegSizeInBits(*RI.getRegClass(RCID));
7254+
unsigned currSize = RI.getRegSizeInBits(*RC);
7255+
if (expectedSize == 16 && currSize == 32) {
72547256
Op.setSubReg(AMDGPU::lo16);
7255-
} else if (16 == RI.getRegSizeInBits(*RC) &&
7256-
32 == RI.getRegSizeInBits(*ExpectedRC)) {
7257+
} else if (expectedSize == 32 && currSize == 16) {
72577258
const DebugLoc &DL = MI.getDebugLoc();
72587259
Register NewDstReg =
72597260
MRI.createVirtualRegister(&AMDGPU::VGPR_32RegClass);

0 commit comments

Comments
 (0)