[llvm-branch-commits] [llvm] [mcp-frameinst: 2/3]: [MCP][NFC] Opinionated refactoring (PR #186239)

Scott Linder via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 7 14:05:19 PDT 2026


slinder1 wrote:

Changes since last push:
```diff
diff --git b/llvm/lib/CodeGen/MachineCopyPropagation.cpp a/llvm/lib/CodeGen/MachineCopyPropagation.cpp
@@ -598,7 +598,7 @@ static bool isNopCopy(const MachineInstr &PreviousCopy, MCRegister Src,
 /// copying the super registers.
 bool MachineCopyPropagation::eraseIfRedundant(MachineInstr &Copy,
                                               MCRegister Dst, MCRegister Src) {
-  if (isNeverRedundant(Copy) || isNeverRedundant(Src) || isNeverRedundant(Dst))
+  if (isNeverRedundant(Src) || isNeverRedundant(Dst))
     return false;
 
   // Search for an existing copy.
@@ -659,7 +659,7 @@ bool MachineCopyPropagation::isBackwardPropagatableCopy(
   if (!Dst || !Src)
     return false;
 
-  if (isNeverRedundant(Copy) || isNeverRedundant(Dst) || isNeverRedundant(Src))
+  if (isNeverRedundant(Src))
     return false;
 
   return CopyOperands.Source->isRenamable() && CopyOperands.Source->isKill();
@@ -946,7 +946,7 @@ void MachineCopyPropagation::forwardCopyPropagateBlock(MachineBasicBlock &MBB) {
       if (!TRI->regsOverlap(Dst, Src)) {
         // FIXME: Document why this does not consider `RegSrc`, similar to how
         // `backwardCopyPropagateBlock` does.
-        if (!isNeverRedundant(MI) && !isNeverRedundant(Dst))
+        if (!isNeverRedundant(Dst))
           MaybeDeadCopies.insert(&MI);
       }
     }
@@ -991,7 +991,7 @@ void MachineCopyPropagation::forwardCopyPropagateBlock(MachineBasicBlock &MBB) {
         std::optional<DestSourcePair> CopyOperands =
             isCopyInstr(*MaybeDead, *TII, UseCopyInstr);
         MCRegister Reg = CopyOperands->Destination->getReg().asMCReg();
-        assert(!isNeverRedundant(*MaybeDead) && !isNeverRedundant(Reg));
+        assert(!isNeverRedundant(Reg));
 
         if (!RegMask->clobbersPhysReg(Reg)) {
           ++DI;
@@ -1059,7 +1059,7 @@ void MachineCopyPropagation::forwardCopyPropagateBlock(MachineBasicBlock &MBB) {
           *isCopyInstr(*MaybeDead, *TII, UseCopyInstr);
 
       auto [Dst, Src] = getDstSrcMCRegs(CopyOperands);
-      assert(!isNeverRedundant(*MaybeDead) && !isNeverRedundant(Dst));
+      assert(!isNeverRedundant(Dst));
 
       // Update matching debug values, if any.
       const auto &DbgUsers = CopyDbgUsers[MaybeDead];

```

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


More information about the llvm-branch-commits mailing list