[llvm] [CodeGen] Port `two-address-instructions` to new pass manager (PR #98632)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 12 06:48:31 PDT 2024


================
@@ -203,26 +226,75 @@ class TwoAddressInstructionPass : public MachineFunctionPass {
     AU.addPreservedID(MachineDominatorsID);
     MachineFunctionPass::getAnalysisUsage(AU);
   }
-
-  /// Pass entry point.
-  bool runOnMachineFunction(MachineFunction&) override;
 };
 
 } // end anonymous namespace
 
-char TwoAddressInstructionPass::ID = 0;
+PreservedAnalyses
+TwoAddressInstructionPass::run(MachineFunction &MF,
+                               MachineFunctionAnalysisManager &MFAM) {
+  // Disable optimizations if requested. We cannot skip the whole pass as some
+  // fixups are necessary for correctness.
+  TwoAddressInstructionImpl Impl(MF, MFAM);
+  if (MF.getFunction().hasOptNone())
----------------
arsenm wrote:

shouldn't this be skipFunction the same way? 

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


More information about the llvm-commits mailing list