[llvm] 825b7f0 - InlineSpiller: Fix copy identification bugs in isCopyOfBundle
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 17 17:08:10 PDT 2023
Author: Matt Arsenault
Date: 2023-07-17T20:05:56-04:00
New Revision: 825b7f0ca5f2211ec3c93139f98d1e24048c225c
URL: https://github.com/llvm/llvm-project/commit/825b7f0ca5f2211ec3c93139f98d1e24048c225c
DIFF: https://github.com/llvm/llvm-project/commit/825b7f0ca5f2211ec3c93139f98d1e24048c225c.diff
LOG: InlineSpiller: Fix copy identification bugs in isCopyOfBundle
Noticed by inspection of
b7836d856206ec39509d42529f958c920368166b. 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.
Added:
Modified:
llvm/lib/CodeGen/InlineSpiller.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/InlineSpiller.cpp b/llvm/lib/CodeGen/InlineSpiller.cpp
index e797e6953bccc2..c62f3db9d32156 100644
--- a/llvm/lib/CodeGen/InlineSpiller.cpp
+++ b/llvm/lib/CodeGen/InlineSpiller.cpp
@@ -289,11 +289,12 @@ static Register isCopyOfBundle(const MachineInstr &FirstMI, Register Reg,
MachineBasicBlock::const_instr_iterator I = FirstMI.getIterator();
while (I->isBundledWithSucc()) {
const MachineInstr &MI = *I;
- if (!TII.isCopyInstr(FirstMI))
+ auto CopyInst = TII.isCopyInstr(MI);
+ if (!CopyInst)
return Register();
- const MachineOperand &DstOp = MI.getOperand(0);
- const MachineOperand &SrcOp = MI.getOperand(1);
+ const MachineOperand &DstOp = *CopyInst->Destination;
+ const MachineOperand &SrcOp = *CopyInst->Source;
if (DstOp.getReg() == Reg) {
if (!SnipReg)
SnipReg = SrcOp.getReg();
More information about the llvm-commits
mailing list