Skip to content

Commit 825b7f0

Browse files
committed
InlineSpiller: Fix copy identification bugs in isCopyOfBundle
Noticed by inspection of b7836d8. This was checking if the first instruction was a copy, not the current MI. It should fully respect the isCopyInstr result. Hopefully this fixes a reported regression which we can extract a test from.
1 parent 04185f0 commit 825b7f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/CodeGen/InlineSpiller.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,11 +289,12 @@ static Register isCopyOfBundle(const MachineInstr &FirstMI, Register Reg,
289289
MachineBasicBlock::const_instr_iterator I = FirstMI.getIterator();
290290
while (I->isBundledWithSucc()) {
291291
const MachineInstr &MI = *I;
292-
if (!TII.isCopyInstr(FirstMI))
292+
auto CopyInst = TII.isCopyInstr(MI);
293+
if (!CopyInst)
293294
return Register();
294295

295-
const MachineOperand &DstOp = MI.getOperand(0);
296-
const MachineOperand &SrcOp = MI.getOperand(1);
296+
const MachineOperand &DstOp = *CopyInst->Destination;
297+
const MachineOperand &SrcOp = *CopyInst->Source;
297298
if (DstOp.getReg() == Reg) {
298299
if (!SnipReg)
299300
SnipReg = SrcOp.getReg();

0 commit comments

Comments
 (0)