[llvm] [mcp-frameinst: 1/3]: [MCP][NFC] Cleanup and prepare to preserve frame-setup/destroy (PR #186240)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 6 14:07:34 PDT 2026


================
@@ -480,9 +477,25 @@ class MachineCopyPropagation {
   bool isBackwardPropagatableRegClassCopy(const MachineInstr &Copy,
                                           const MachineInstr &UseI,
                                           unsigned UseIdx);
+  bool isBackwardPropagatableCopy(const MachineInstr &Copy,
+                                  const DestSourcePair &CopyOperands);
+  /// Returns true iff a copy instruction having operand @p CopyOperand must
+  /// never be eliminated as redundant.
+  bool isNeverRedundant(MCRegister CopyOperand) {
+    // Avoid eliminating a copy from/to a reserved registers as we cannot
+    // predict the value (Example: The sparc zero register is writable but stays
+    // zero).
+    return MRI->isReserved(CopyOperand);
+  }
+  /// Returns true iff the @p Copy instruction must never be eliminated as
+  /// redundant. This overload does not consider the operands of @p Copy.
+  bool isNeverRedundant(const MachineInstr &Copy) {
+    // FIXME: A future change will implement this.
+    return false;
+  }
----------------
s-barannikov wrote:

I'd prefer this landed together with functional changes

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


More information about the llvm-commits mailing list