Skip to content

Commit 2a39d8b

Browse files
authored
AMDGPU: Remove dead code trying to constrain a physical register (#161790)
This constrainRegClass check would never pass for a physical register.
1 parent 4d32ea8 commit 2a39d8b

File tree

1 file changed

+8
-15
lines changed

1 file changed

+8
-15
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8117,21 +8117,14 @@ void SIInstrInfo::moveToVALUImpl(SIInstrWorklist &Worklist,
81178117
// hope for the best.
81188118
if (Inst.isCopy() && DstReg.isPhysical() &&
81198119
RI.isVGPR(MRI, Inst.getOperand(1).getReg())) {
8120-
// TODO: Only works for 32 bit registers.
8121-
if (MRI.constrainRegClass(DstReg, &AMDGPU::SReg_32_XM0RegClass)) {
8122-
BuildMI(*Inst.getParent(), &Inst, Inst.getDebugLoc(),
8123-
get(AMDGPU::V_READFIRSTLANE_B32), DstReg)
8124-
.add(Inst.getOperand(1));
8125-
} else {
8126-
Register NewDst =
8127-
MRI.createVirtualRegister(&AMDGPU::SReg_32_XM0RegClass);
8128-
BuildMI(*Inst.getParent(), &Inst, Inst.getDebugLoc(),
8129-
get(AMDGPU::V_READFIRSTLANE_B32), NewDst)
8130-
.add(Inst.getOperand(1));
8131-
BuildMI(*Inst.getParent(), &Inst, Inst.getDebugLoc(), get(AMDGPU::COPY),
8132-
DstReg)
8133-
.addReg(NewDst);
8134-
}
8120+
Register NewDst = MRI.createVirtualRegister(&AMDGPU::SReg_32_XM0RegClass);
8121+
BuildMI(*Inst.getParent(), &Inst, Inst.getDebugLoc(),
8122+
get(AMDGPU::V_READFIRSTLANE_B32), NewDst)
8123+
.add(Inst.getOperand(1));
8124+
BuildMI(*Inst.getParent(), &Inst, Inst.getDebugLoc(), get(AMDGPU::COPY),
8125+
DstReg)
8126+
.addReg(NewDst);
8127+
81358128
Inst.eraseFromParent();
81368129
return;
81378130
}

0 commit comments

Comments
 (0)