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

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Apr 10 05:53:37 PDT 2026


================
@@ -164,14 +181,12 @@ class CopyTracker {
     // the subregisters used in the source of the COPY.
     SmallSet<MCRegUnit, 8> RegUnitsToInvalidate;
     auto InvalidateCopy = [&](MachineInstr *MI) {
-      std::optional<DestSourcePair> CopyOperands =
-          isCopyInstr(*MI, TII, UseCopyInstr);
-      assert(CopyOperands && "Expect copy");
-
-      auto Dest = TRI.regunits(CopyOperands->Destination->getReg().asMCReg());
-      auto Src = TRI.regunits(CopyOperands->Source->getReg().asMCReg());
-      RegUnitsToInvalidate.insert_range(Dest);
-      RegUnitsToInvalidate.insert_range(Src);
+      DestSourcePair CopyOperands = *isCopyInstr(*MI, TII, UseCopyInstr);
+      auto [Dst, Src] = getDstSrcMCRegs(CopyOperands);
+      auto DstUnits = TRI.regunits(Dst);
+      auto SrcUnits = TRI.regunits(Src);
+      RegUnitsToInvalidate.insert_range(DstUnits);
+      RegUnitsToInvalidate.insert_range(SrcUnits);
----------------
arsenm wrote:

```suggestion
      RegUnitsToInvalidate.insert_range(TRI.regunits(Dst));
      RegUnitsToInvalidate.insert_range(TRI.regunits(Src));
```

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


More information about the llvm-branch-commits mailing list