[llvm] [CodeGen] Transfer implicit-defs to first instruction when lowering multi-instruction COPY (PR #194892)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 16 00:54:06 PDT 2026


================
@@ -870,20 +870,44 @@ TargetInstrInfo::foldMemoryOperand(MachineInstr &MI, ArrayRef<unsigned> Ops,
 /// replacement instructions immediately precede it.  Copy any implicit
 /// operands from MI to the replacement instruction.
 static void transferImplicitOperands(MachineInstr *MI,
+                                     MachineBasicBlock::instr_iterator FirstMI,
                                      const TargetRegisterInfo *TRI) {
-  MachineBasicBlock::iterator CopyMI = MI;
-  --CopyMI;
+  MachineBasicBlock::instr_iterator LastMI = MI->getIterator();
----------------
arsenm wrote:

This probably shouldn't be using instr_iterator. This code doesn't look bundle-safe as is, and the test does not involve a bundle so this probably isn't what you want 

https://github.com/llvm/llvm-project/pull/194892


More information about the llvm-commits mailing list