Skip to content

Commit 1c2779f

Browse files
committed
Fix bug and update tests
1 parent b28755a commit 1c2779f

File tree

4 files changed

+302
-265
lines changed

4 files changed

+302
-265
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,7 +1314,7 @@ Register SIInstrInfo::insertNE(MachineBasicBlock *MBB,
13141314

13151315
MachineInstr *
13161316
SIInstrInfo::pierceThroughRegSequence(const MachineInstr &MI) const {
1317-
if (MI.getOpcode() != AMDGPU::REG_SEQUENCE)
1317+
if (MI.getOpcode() != AMDGPU::REG_SEQUENCE || MI.getNumOperands() != 5)
13181318
return nullptr;
13191319

13201320
const MachineRegisterInfo &MRI = MI.getParent()->getParent()->getRegInfo();
@@ -1330,7 +1330,11 @@ SIInstrInfo::pierceThroughRegSequence(const MachineInstr &MI) const {
13301330
}
13311331

13321332
for (unsigned I : {0, 1})
1333-
if (SubRegIsConst[I] && !SubRegValues[I])
1333+
if (SubRegIsConst[I] && !SubRegValues[I] &&
1334+
MRI.getRegClass(RealDefs[(I + 1) % 2]->getOperand(0).getReg())
1335+
->MC->getSizeInBits() *
1336+
2 ==
1337+
MRI.getRegClass(MI.getOperand(0).getReg())->MC->getSizeInBits())
13341338
return RealDefs[(I + 1) % 2];
13351339

13361340
return nullptr;

0 commit comments

Comments
 (0)