[llvm] [NewPM] Adds a port for AArch64O0PreLegalizerCombiner (PR #189776)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 1 19:02:41 PDT 2026


================
@@ -161,32 +190,63 @@ bool AArch64O0PreLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) {
       getAnalysis<LibcallLoweringInfoWrapper>().getLibcallLowering(
           *F.getParent(), ST);
 
-  CombinerInfo CInfo(/*AllowIllegalOps*/ true, /*ShouldLegalizeIllegal*/ false,
-                     /*LegalizerInfo*/ nullptr, /*EnableOpt*/ false,
-                     F.hasOptSize(), F.hasMinSize());
-  // Disable fixed-point iteration in the Combiner. This improves compile-time
-  // at the cost of possibly missing optimizations. See PR#94291 for details.
-  CInfo.MaxIterations = 1;
-
-  AArch64O0PreLegalizerCombinerImpl Impl(MF, CInfo, *VT,
-                                         /*CSEInfo*/ nullptr, RuleConfig, ST,
-                                         Libcalls);
-  return Impl.combineMachineInstrs();
+  return runCombiner(MF, VT, Libcalls, RuleConfig);
 }
 
-char AArch64O0PreLegalizerCombiner::ID = 0;
-INITIALIZE_PASS_BEGIN(AArch64O0PreLegalizerCombiner, DEBUG_TYPE,
+char AArch64O0PreLegalizerCombinerLegacy::ID = 0;
+INITIALIZE_PASS_BEGIN(AArch64O0PreLegalizerCombinerLegacy, DEBUG_TYPE,
                       "Combine AArch64 machine instrs before legalization",
                       false, false)
 INITIALIZE_PASS_DEPENDENCY(GISelValueTrackingAnalysisLegacy)
 INITIALIZE_PASS_DEPENDENCY(GISelCSEAnalysisWrapperPass)
 INITIALIZE_PASS_DEPENDENCY(LibcallLoweringInfoWrapper)
-INITIALIZE_PASS_END(AArch64O0PreLegalizerCombiner, DEBUG_TYPE,
+INITIALIZE_PASS_END(AArch64O0PreLegalizerCombinerLegacy, DEBUG_TYPE,
                     "Combine AArch64 machine instrs before legalization", false,
                     false)
 
+AArch64O0PreLegalizerCombinerPass::AArch64O0PreLegalizerCombinerPass()
+    : RuleConfig(
+          std::make_unique<AArch64O0PreLegalizerCombinerImplRuleConfig>()) {
+  if (!RuleConfig->parseCommandLineOption())
+    report_fatal_error("Invalid rule identifier");
+}
+
+AArch64O0PreLegalizerCombinerPass::AArch64O0PreLegalizerCombinerPass(
----------------
boomanaiden154 wrote:

Why do we need to explicitly set these to `default`?

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


More information about the llvm-commits mailing list