[llvm-branch-commits] [RISCV] Port PostLegalizerCombiner to NewPM (PR #235951)

Aiden Grossman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Oct 29 21:17:05 PDT 2026


================
@@ -163,31 +166,32 @@ void RISCVPostLegalizerCombiner::getAnalysisUsage(AnalysisUsage &AU) const {
   MachineFunctionPass::getAnalysisUsage(AU);
 }
 
-RISCVPostLegalizerCombiner::RISCVPostLegalizerCombiner()
-    : MachineFunctionPass(ID) {
-  if (!RuleConfig.parseCommandLineOption())
-    report_fatal_error("Invalid rule identifier");
-}
+RISCVPostLegalizerCombinerLegacy::RISCVPostLegalizerCombinerLegacy()
+    : MachineFunctionPass(ID) {}
 
-bool RISCVPostLegalizerCombiner::runOnMachineFunction(MachineFunction &MF) {
+static bool
+runCombinerOnMachineFunction(MachineFunction &MF,
+                             function_ref<bool()> ShouldSkip,
+                             function_ref<GISelValueTracking *()> GetVT,
+                             function_ref<MachineDominatorTree *()> GetMDT,
+                             function_ref<GISelCSEInfo *()> GetCSEInfo) {
   if (MF.getProperties().hasFailedISel())
     return false;
   assert(MF.getProperties().hasLegalized() && "Expected a legalized function?");
-  auto *TPC = &getAnalysis<TargetPassConfig>();
   const Function &F = MF.getFunction();
   bool EnableOpt =
-      MF.getTarget().getOptLevel() != CodeGenOptLevel::None && !skipFunction(F);
+      MF.getTarget().getOptLevel() != CodeGenOptLevel::None && !ShouldSkip();
+
+  RISCVPostLegalizerCombinerImplRuleConfig RuleConfig;
----------------
boomanaiden154 wrote:

Negligible from my understanding. It only holds a SparseBitVector, and the command line parsing is also super cheap.

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


More information about the llvm-branch-commits mailing list