Skip to content

Commit 221099c

Browse files
committed
Fix bug and update tests
1 parent de0102e commit 221099c

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
@@ -1315,7 +1315,7 @@ Register SIInstrInfo::insertNE(MachineBasicBlock *MBB,
13151315

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

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

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

13371341
return nullptr;

0 commit comments

Comments
 (0)