Skip to content

[MLIR] Remove let constructor = from mlir/include/mlir/Transforms/Passes.td#183950

Merged
joker-eph merged 1 commit into
llvm:mainfrom
joker-eph:let_constructor_removal
Mar 1, 2026
Merged

[MLIR] Remove let constructor = from mlir/include/mlir/Transforms/Passes.td#183950
joker-eph merged 1 commit into
llvm:mainfrom
joker-eph:let_constructor_removal

Conversation

@joker-eph
Copy link
Copy Markdown
Contributor

This makes the constructor auto-generated.

@joker-eph joker-eph requested a review from chelini February 28, 2026 20:46
@llvmbot llvmbot added mlir:core MLIR Core Infrastructure mlir labels Feb 28, 2026
@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Feb 28, 2026

@llvm/pr-subscribers-mlir

Author: Mehdi Amini (joker-eph)

Changes

This makes the constructor auto-generated.


Patch is 36.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/183950.diff

20 Files Affected:

  • (modified) mlir/include/mlir/Transforms/Passes.h (+20-69)
  • (modified) mlir/include/mlir/Transforms/Passes.td (+15-32)
  • (modified) mlir/include/mlir/Transforms/ViewOpGraph.h (+3-3)
  • (modified) mlir/lib/Transforms/CSE.cpp (+2-4)
  • (modified) mlir/lib/Transforms/Canonicalizer.cpp (+3-8)
  • (modified) mlir/lib/Transforms/ControlFlowSink.cpp (+2-6)
  • (modified) mlir/lib/Transforms/GenerateRuntimeVerification.cpp (+4-6)
  • (modified) mlir/lib/Transforms/InlinerPass.cpp (+3-5)
  • (modified) mlir/lib/Transforms/LoopInvariantCodeMotion.cpp (+4-12)
  • (modified) mlir/lib/Transforms/OpStats.cpp (+18-16)
  • (modified) mlir/lib/Transforms/PrintIR.cpp (+4-6)
  • (modified) mlir/lib/Transforms/RemoveDeadValues.cpp (+5-6)
  • (modified) mlir/lib/Transforms/SCCP.cpp (+2-6)
  • (modified) mlir/lib/Transforms/StripDebugInfo.cpp (+2-7)
  • (modified) mlir/lib/Transforms/SymbolDCE.cpp (+2-6)
  • (modified) mlir/lib/Transforms/SymbolPrivatize.cpp (+3-12)
  • (modified) mlir/lib/Transforms/TopologicalSort.cpp (+2-6)
  • (modified) mlir/lib/Transforms/ViewOpGraph.cpp (+7-3)
  • (modified) mlir/test/CAPI/pass.c (+5-5)
  • (modified) mlir/test/Transforms/composite-pass.mlir (+10-10)
diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h
index 9983944d374c5..4804b023a8f79 100644
--- a/mlir/include/mlir/Transforms/Passes.h
+++ b/mlir/include/mlir/Transforms/Passes.h
@@ -32,29 +32,26 @@ class GreedyRewriteConfig;
 //===----------------------------------------------------------------------===//
 
 #define GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
-#define GEN_PASS_DECL_CSE
-#define GEN_PASS_DECL_CANONICALIZER
+#define GEN_PASS_DECL_CSEPASS
+#define GEN_PASS_DECL_CANONICALIZERPASS
 #define GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
-#define GEN_PASS_DECL_CONTROLFLOWSINK
-#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATION
-#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTION
-#define GEN_PASS_DECL_INLINER
+#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
+#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
+#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
+#define GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
+#define GEN_PASS_DECL_INLINERPASS
 #define GEN_PASS_DECL_MEM2REG
 #define GEN_PASS_DECL_PRINTIRPASS
-#define GEN_PASS_DECL_PRINTOPSTATS
-#define GEN_PASS_DECL_REMOVEDEADVALUES
-#define GEN_PASS_DECL_SCCP
+#define GEN_PASS_DECL_PRINTOPSTATSPASS
+#define GEN_PASS_DECL_REMOVEDEADVALUESPASS
+#define GEN_PASS_DECL_SCCPPASS
 #define GEN_PASS_DECL_SROA
-#define GEN_PASS_DECL_STRIPDEBUGINFO
-#define GEN_PASS_DECL_SYMBOLDCE
-#define GEN_PASS_DECL_SYMBOLPRIVATIZE
-#define GEN_PASS_DECL_TOPOLOGICALSORT
+#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
+#define GEN_PASS_DECL_SYMBOLDCEPASS
+#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
+#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
 #include "mlir/Transforms/Passes.h.inc"
 
-/// Creates an instance of the Canonicalizer pass, configured with default
-/// settings (which can be overridden by pass options on the command line).
-std::unique_ptr<Pass> createCanonicalizerPass();
-
 /// Creates an instance of the Canonicalizer pass with the specified config.
 /// `disabledPatterns` is a set of labels used to filter out input patterns with
 /// a debug label or debug name in this set. `enabledPatterns` is a set of
@@ -68,39 +65,6 @@ createCanonicalizerPass(const GreedyRewriteConfig &config,
                         ArrayRef<std::string> disabledPatterns = {},
                         ArrayRef<std::string> enabledPatterns = {});
 
-/// Creates a pass to perform control-flow sinking.
-std::unique_ptr<Pass> createControlFlowSinkPass();
-
-/// Creates a pass to perform common sub expression elimination.
-std::unique_ptr<Pass> createCSEPass();
-
-/// Creates a pass to print IR on the debug stream.
-std::unique_ptr<Pass> createPrintIRPass(const PrintIRPassOptions & = {});
-
-/// Creates a pass that generates IR to verify ops at runtime.
-std::unique_ptr<Pass> createGenerateRuntimeVerificationPass();
-
-/// Creates a loop invariant code motion pass that hoists loop invariant
-/// instructions out of the loop.
-std::unique_ptr<Pass> createLoopInvariantCodeMotionPass();
-
-/// Creates a pass that hoists loop-invariant subset ops.
-std::unique_ptr<Pass> createLoopInvariantSubsetHoistingPass();
-
-/// Creates a pass to strip debug information from a function.
-std::unique_ptr<Pass> createStripDebugInfoPass();
-
-/// Creates a pass which prints the list of ops and the number of occurrences in
-/// the module.
-std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
-
-/// Creates a pass which prints the list of ops and the number of occurrences in
-/// the module with the output format option.
-std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
-
-/// Creates a pass which inlines calls and callable operations as defined by
-/// the CallGraph.
-std::unique_ptr<Pass> createInlinerPass();
 /// Creates an instance of the inliner pass, and use the provided pass managers
 /// when optimizing callable operations with names matching the key type.
 /// Callable operations with a name not within the provided map will use the
@@ -115,26 +79,13 @@ std::unique_ptr<Pass>
 createInlinerPass(llvm::StringMap<OpPassManager> opPipelines,
                   std::function<void(OpPassManager &)> defaultPipelineBuilder);
 
-/// Creates an optimization pass to remove dead values.
-std::unique_ptr<Pass> createRemoveDeadValuesPass();
-
-/// Creates a pass which performs sparse conditional constant propagation over
-/// nested operations.
-std::unique_ptr<Pass> createSCCPPass();
-
-/// Creates a pass which delete symbol operations that are unreachable. This
-/// pass may *only* be scheduled on an operation that defines a SymbolTable.
-std::unique_ptr<Pass> createSymbolDCEPass();
-
-/// Creates a pass which marks top-level symbol operations as `private` unless
-/// listed in `excludeSymbols`.
-std::unique_ptr<Pass>
-createSymbolPrivatizePass(ArrayRef<std::string> excludeSymbols = {});
+/// Creates a pass which prints the list of ops and the number of occurrences in
+/// the module.
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os);
 
-/// Creates a pass that recursively sorts nested regions without SSA dominance
-/// topologically such that, as much as possible, users of values appear after
-/// their producers.
-std::unique_ptr<Pass> createTopologicalSortPass();
+/// Creates a pass which prints the list of ops and the number of occurrences in
+/// the module with the output format option.
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
 
 /// Create composite pass, which runs provided set of passes until fixed point
 /// or maximum number of iterations reached.
diff --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td
index fc2d60d198cd6..20af90e56ee67 100644
--- a/mlir/include/mlir/Transforms/Passes.td
+++ b/mlir/include/mlir/Transforms/Passes.td
@@ -16,7 +16,7 @@
 include "mlir/Pass/PassBase.td"
 include "mlir/Rewrite/PassUtil.td"
 
-def Canonicalizer : Pass<"canonicalize"> {
+def CanonicalizerPass : Pass<"canonicalize"> {
   let summary = "Canonicalize operations";
   let description = [{
     This pass performs various types of canonicalizations over a set of
@@ -27,7 +27,6 @@ def Canonicalizer : Pass<"canonicalize"> {
     pass. See [Operation Canonicalization](Canonicalization.md) for more
     details.
   }];
-  let constructor = "mlir::createCanonicalizerPass()";
   let options = [
     Option<"topDownProcessingEnabled", "top-down", "bool",
            /*default=*/"true",
@@ -53,7 +52,7 @@ def Canonicalizer : Pass<"canonicalize"> {
   ] # RewritePassUtils.options;
 }
 
-def ControlFlowSink : Pass<"control-flow-sink"> {
+def ControlFlowSinkPass : Pass<"control-flow-sink"> {
   let summary = "Sink operations into conditional blocks";
   let description = [{
     This pass implements control-flow sink on operations that implement
@@ -71,13 +70,12 @@ def ControlFlowSink : Pass<"control-flow-sink"> {
     blocks: ops in unreachable blocks may prevent other operations from being
     sunk as they may contain uses of their results
   }];
-  let constructor = "::mlir::createControlFlowSinkPass()";
   let statistics = [
     Statistic<"numSunk", "num-sunk", "Number of operations sunk">,
   ];
 }
 
-def CSE : Pass<"cse"> {
+def CSEPass : Pass<"cse"> {
   let summary = "Eliminate common sub-expressions";
   let description = [{
     This pass implements a generalized algorithm for common sub-expression
@@ -86,14 +84,13 @@ def CSE : Pass<"cse"> {
     operations. See [Common subexpression elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination)
     for more general details on this optimization.
   }];
-  let constructor = "mlir::createCSEPass()";
   let statistics = [
     Statistic<"numCSE", "num-cse'd", "Number of operations CSE'd">,
     Statistic<"numDCE", "num-dce'd", "Number of operations DCE'd">
   ];
 }
 
-def RemoveDeadValues : Pass<"remove-dead-values"> {
+def RemoveDeadValuesPass : Pass<"remove-dead-values"> {
   let summary = "Remove dead values";
   let description = [{
     The goal of this pass is optimization (reducing runtime) by removing
@@ -257,7 +254,6 @@ def RemoveDeadValues : Pass<"remove-dead-values"> {
     Option<"canonicalize", "canonicalize", "bool", /*default=*/"true",
            "Canonicalize region branch ops">,
   ];
-  let constructor = "mlir::createRemoveDeadValuesPass()";
   let dependentDialects = ["ub::UBDialect"];
 }
 
@@ -267,20 +263,18 @@ def PrintIRPass : Pass<"print-ir"> {
     Print the entire IR on the debug stream. This is meant for debugging
     purposes to inspect the IR at a specific point in the pipeline.
   }];
-  let constructor = "mlir::createPrintIRPass()";
   let options = [
     Option<"label", "label", "std::string", /*default=*/"", "Label">,
   ];
 }
 
-def GenerateRuntimeVerification : Pass<"generate-runtime-verification"> {
+def GenerateRuntimeVerificationPass : Pass<"generate-runtime-verification"> {
   let summary = "Generate additional runtime op verification checks";
   let description = [{
     This pass generates op-specific runtime checks using the
     `RuntimeVerifiableOpInterface`. It can be run for debugging purposes after
     passes that are suspected to introduce faulty IR.
   }];
-  let constructor = "mlir::createGenerateRuntimeVerificationPass()";
   let options = [
     Option<"verboseLevel", "verbose-level", "unsigned", /*default=*/"1",
            "Verbosity level for runtime verification messages: "
@@ -290,9 +284,8 @@ def GenerateRuntimeVerification : Pass<"generate-runtime-verification"> {
 }
 
 
-def Inliner : Pass<"inline"> {
+def InlinerPass : Pass<"inline"> {
   let summary = "Inline function calls";
-  let constructor = "mlir::createInlinerPass()";
   let options = [
     Option<"defaultPipelineStr", "default-pipeline", "std::string",
            /*default=*/"\"canonicalize\"",
@@ -367,14 +360,12 @@ def LocationSnapshot : Pass<"snapshot-op-locations"> {
   ];
 }
 
-def LoopInvariantCodeMotion : Pass<"loop-invariant-code-motion"> {
+def LoopInvariantCodeMotionPass : Pass<"loop-invariant-code-motion"> {
   let summary = "Hoist loop invariant instructions outside of the loop";
-  let constructor = "mlir::createLoopInvariantCodeMotionPass()";
 }
 
-def LoopInvariantSubsetHoisting : Pass<"loop-invariant-subset-hoisting"> {
+def LoopInvariantSubsetHoistingPass : Pass<"loop-invariant-subset-hoisting"> {
   let summary = "Hoist loop invariant subset ops outside of the loop";
-  let constructor = "mlir::createLoopInvariantSubsetHoistingPass()";
 }
 
 def Mem2Reg : Pass<"mem2reg"> {
@@ -411,16 +402,15 @@ def Mem2Reg : Pass<"mem2reg"> {
   ];
 }
 
-def PrintOpStats : Pass<"print-op-stats"> {
+def PrintOpStatsPass : Pass<"print-op-stats"> {
   let summary = "Print statistics of operations";
-  let constructor = "mlir::createPrintOpStatsPass()";
   let options = [
     Option<"printAsJSON", "json", "bool", /*default=*/"false",
            "print the stats as JSON">
   ];
 }
 
-def SCCP : Pass<"sccp"> {
+def SCCPPass : Pass<"sccp"> {
   let summary = "Sparse Conditional Constant Propagation";
   let description = [{
     This pass implements a general algorithm for sparse conditional constant
@@ -431,7 +421,6 @@ def SCCP : Pass<"sccp"> {
     This implementation is based on the algorithm described by Wegman and Zadeck
     in [“Constant Propagation with Conditional Branches”](https://dl.acm.org/doi/10.1145/103135.103136) (1991).
   }];
-  let constructor = "mlir::createSCCPPass()";
 }
 
 def SROA : Pass<"sroa"> {
@@ -470,16 +459,15 @@ def SROA : Pass<"sroa"> {
   ];
 }
 
-def StripDebugInfo : Pass<"strip-debuginfo"> {
+def StripDebugInfoPass : Pass<"strip-debuginfo"> {
   let summary = "Strip debug info from all operations";
   let description = [{
     This pass strips the IR of any location information, by replacing all
     operation locations with [`unknown`](Dialects/Builtin.md/#unknownloc).
   }];
-  let constructor = "mlir::createStripDebugInfoPass()";
 }
 
-def SymbolDCE : Pass<"symbol-dce"> {
+def SymbolDCEPass : Pass<"symbol-dce"> {
   let summary = "Eliminate dead symbols";
   let description = [{
     This pass deletes all symbols that are found to be unreachable. This is done
@@ -519,14 +507,12 @@ def SymbolDCE : Pass<"symbol-dce"> {
     See [Symbols and SymbolTables](SymbolsAndSymbolTables.md) for more
     information on `Symbols`.
   }];
-  let constructor = "mlir::createSymbolDCEPass()";
-
   let statistics = [
     Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">,
   ];
 }
 
-def SymbolPrivatize : Pass<"symbol-privatize"> {
+def SymbolPrivatizePass : Pass<"symbol-privatize"> {
   let summary = "Mark symbols private";
   let description = [{
     This pass marks all top-level symbols of the operation run as `private`
@@ -536,10 +522,9 @@ def SymbolPrivatize : Pass<"symbol-privatize"> {
     ListOption<"exclude", "exclude", "std::string",
        "Comma separated list of symbols that should not be marked private">
   ];
-  let constructor = "mlir::createSymbolPrivatizePass()";
 }
 
-def ViewOpGraph : Pass<"view-op-graph"> {
+def ViewOpGraphPass : Pass<"view-op-graph"> {
   let summary = "Print Graphviz visualization of an operation";
   let description = [{
     This pass prints a Graphviz graph of a module.
@@ -566,10 +551,9 @@ def ViewOpGraph : Pass<"view-op-graph"> {
     Option<"printResultTypes", "print-result-types", "bool",
             /*default=*/"true", "Print result types of operations">
   ];
-  let constructor = "mlir::createPrintOpGraphPass()";
 }
 
-def TopologicalSort : Pass<"topological-sort"> {
+def TopologicalSortPass : Pass<"topological-sort"> {
   let summary = "Sort regions without SSA dominance in topological order";
   let description = [{
     Recursively sorts all nested regions without SSA dominance in topological
@@ -583,7 +567,6 @@ def TopologicalSort : Pass<"topological-sort"> {
     regions in a stable order.
   }];
 
-  let constructor = "mlir::createTopologicalSortPass()";
 }
 
 def CompositeFixedPointPass : Pass<"composite-fixed-point-pass"> {
diff --git a/mlir/include/mlir/Transforms/ViewOpGraph.h b/mlir/include/mlir/Transforms/ViewOpGraph.h
index 523ed38fba1da..c48844a85ec83 100644
--- a/mlir/include/mlir/Transforms/ViewOpGraph.h
+++ b/mlir/include/mlir/Transforms/ViewOpGraph.h
@@ -19,11 +19,11 @@
 namespace mlir {
 class Pass;
 
-#define GEN_PASS_DECL_VIEWOPGRAPH
+#define GEN_PASS_DECL_VIEWOPGRAPHPASS
 #include "mlir/Transforms/Passes.h.inc"
 
-/// Creates a pass to print op graphs.
-std::unique_ptr<Pass> createPrintOpGraphPass(raw_ostream &os = llvm::errs());
+/// Creates a pass to print op graphs with the specified output stream.
+std::unique_ptr<Pass> createViewOpGraphPass(raw_ostream &os);
 
 } // namespace mlir
 
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index 8eaac308755fd..48a20655b2806 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -25,7 +25,7 @@
 #include <deque>
 
 namespace mlir {
-#define GEN_PASS_DEF_CSE
+#define GEN_PASS_DEF_CSEPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -384,7 +384,7 @@ void mlir::eliminateCommonSubExpressions(RewriterBase &rewriter,
 
 namespace {
 /// CSE pass.
-struct CSE : public impl::CSEBase<CSE> {
+struct CSE : public impl::CSEPassBase<CSE> {
   void runOnOperation() override;
 };
 } // namespace
@@ -408,5 +408,3 @@ void CSE::runOnOperation() {
   // preserved.
   markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
 }
-
-std::unique_ptr<Pass> mlir::createCSEPass() { return std::make_unique<CSE>(); }
diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp
index 7a99fe86d09f5..9f9bad1c2a678 100644
--- a/mlir/lib/Transforms/Canonicalizer.cpp
+++ b/mlir/lib/Transforms/Canonicalizer.cpp
@@ -17,7 +17,7 @@
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_CANONICALIZER
+#define GEN_PASS_DEF_CANONICALIZERPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -25,8 +25,8 @@ using namespace mlir;
 
 namespace {
 /// Canonicalize operations in nested regions.
-struct Canonicalizer : public impl::CanonicalizerBase<Canonicalizer> {
-  Canonicalizer() = default;
+struct Canonicalizer : public impl::CanonicalizerPassBase<Canonicalizer> {
+  using impl::CanonicalizerPassBase<Canonicalizer>::CanonicalizerPassBase;
   Canonicalizer(const GreedyRewriteConfig &config,
                 ArrayRef<std::string> disabledPatterns,
                 ArrayRef<std::string> enabledPatterns)
@@ -70,11 +70,6 @@ struct Canonicalizer : public impl::CanonicalizerBase<Canonicalizer> {
 };
 } // namespace
 
-/// Create a Canonicalizer pass.
-std::unique_ptr<Pass> mlir::createCanonicalizerPass() {
-  return std::make_unique<Canonicalizer>();
-}
-
 /// Creates an instance of the Canonicalizer pass with the specified config.
 std::unique_ptr<Pass>
 mlir::createCanonicalizerPass(const GreedyRewriteConfig &config,
diff --git a/mlir/lib/Transforms/ControlFlowSink.cpp b/mlir/lib/Transforms/ControlFlowSink.cpp
index 4e1dfa1c7c83f..eed9c1cdab36d 100644
--- a/mlir/lib/Transforms/ControlFlowSink.cpp
+++ b/mlir/lib/Transforms/ControlFlowSink.cpp
@@ -21,7 +21,7 @@
 #include "mlir/Transforms/ControlFlowSinkUtils.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_CONTROLFLOWSINK
+#define GEN_PASS_DEF_CONTROLFLOWSINKPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -29,7 +29,7 @@ using namespace mlir;
 
 namespace {
 /// A control-flow sink pass.
-struct ControlFlowSink : public impl::ControlFlowSinkBase<ControlFlowSink> {
+struct ControlFlowSink : public impl::ControlFlowSinkPassBase<ControlFlowSink> {
   void runOnOperation() override;
 };
 } // end anonymous namespace
@@ -52,7 +52,3 @@ void ControlFlowSink::runOnOperation() {
         });
   });
 }
-
-std::unique_ptr<Pass> mlir::createControlFlowSinkPass() {
-  return std::make_unique<ControlFlowSink>();
-}
diff --git a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
index 1e226c03972b0..29512a5eebcc5 100644
--- a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
+++ b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
@@ -14,7 +14,7 @@
 #include "mlir/Interfaces/RuntimeVerifiableOpInterface.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_GENERATERUNTIMEVERIFICATION
+#define GEN_PASS_DEF_GENERATERUNTIMEVERIFICATIONPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -22,8 +22,10 @@ using namespace mlir;
 
 namespace {
 struct GenerateRuntimeVerificationPass
-    : public impl::GenerateRuntimeVerificationBase<
+    : public impl::GenerateRuntimeVerificationPassBase<
           GenerateRuntimeVerificationPass> {
+  using impl::GenerateRuntimeVerificationPassBase<
+      GenerateRuntimeVerificationPass>::GenerateRuntimeVerificationPassBase;
   void runOnOperation() override;
 };
 
@@ -99,7 +101,3 @@ void GenerateRuntimeVerificationPass::runOnOperation() {
                                              defaultErrMsgGenerator);
   };
 }
-
-std::unique_ptr<Pass> mlir::createGenerateRuntimeVerificationPass() {
-  return std::make_unique<GenerateRuntimeVerificationPass>();
-}
diff --git a/mlir/lib/Transforms/InlinerPass.cpp b/mlir/lib/Transforms/InlinerPass.cpp
index 77a9e6cbd8c9f..423aad316be0d 100644
--- a/mlir/lib/Transforms/InlinerPass.cpp
+++ b/mlir/lib/Transforms/InlinerPass.cpp
@@ -21,7 +21,7 @@
 #include "llvm/Support/DebugLog.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_INLINER
+#define GEN_PASS_DEF_INLINERPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -39,8 +39,9 @@ static void defaultInlinerOptPipeline(OpPassManager &pm) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class InlinerPass : public impl::InlinerBase<InlinerPass> {
+class InlinerPass : public impl::InlinerPassBase<InlinerPass> {
 public:
+  using impl::InlinerPassBase<InlinerPass>::InlinerPassBase;
   InlinerPass();
   InlinerPass(const InlinerPass &) = default;
   InlinerPass(std::function<void(OpPassManager &)> defaultPipeline);
@@ -183,9 +184,6 @@ LogicalResult InlinerPass::initializeOptions(
   return success();
 }
 
-std::unique_ptr<Pass> mlir::createInlinerPass() {
-  return std::make_unique<InlinerPass>();
-}
 std::unique_ptr<Pass>
 mlir::createInlinerPass(llvm::StringMap<OpPassManager> opPipelines) {
   return std::make_unique<InlinerPass>(defaultInlinerOptPipeline,
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMo...
[truncated]

@llvmbot
Copy link
Copy Markdown
Member

llvmbot commented Feb 28, 2026

@llvm/pr-subscribers-mlir-core

Author: Mehdi Amini (joker-eph)

Changes

This makes the constructor auto-generated.


Patch is 36.74 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/183950.diff

20 Files Affected:

  • (modified) mlir/include/mlir/Transforms/Passes.h (+20-69)
  • (modified) mlir/include/mlir/Transforms/Passes.td (+15-32)
  • (modified) mlir/include/mlir/Transforms/ViewOpGraph.h (+3-3)
  • (modified) mlir/lib/Transforms/CSE.cpp (+2-4)
  • (modified) mlir/lib/Transforms/Canonicalizer.cpp (+3-8)
  • (modified) mlir/lib/Transforms/ControlFlowSink.cpp (+2-6)
  • (modified) mlir/lib/Transforms/GenerateRuntimeVerification.cpp (+4-6)
  • (modified) mlir/lib/Transforms/InlinerPass.cpp (+3-5)
  • (modified) mlir/lib/Transforms/LoopInvariantCodeMotion.cpp (+4-12)
  • (modified) mlir/lib/Transforms/OpStats.cpp (+18-16)
  • (modified) mlir/lib/Transforms/PrintIR.cpp (+4-6)
  • (modified) mlir/lib/Transforms/RemoveDeadValues.cpp (+5-6)
  • (modified) mlir/lib/Transforms/SCCP.cpp (+2-6)
  • (modified) mlir/lib/Transforms/StripDebugInfo.cpp (+2-7)
  • (modified) mlir/lib/Transforms/SymbolDCE.cpp (+2-6)
  • (modified) mlir/lib/Transforms/SymbolPrivatize.cpp (+3-12)
  • (modified) mlir/lib/Transforms/TopologicalSort.cpp (+2-6)
  • (modified) mlir/lib/Transforms/ViewOpGraph.cpp (+7-3)
  • (modified) mlir/test/CAPI/pass.c (+5-5)
  • (modified) mlir/test/Transforms/composite-pass.mlir (+10-10)
diff --git a/mlir/include/mlir/Transforms/Passes.h b/mlir/include/mlir/Transforms/Passes.h
index 9983944d374c5..4804b023a8f79 100644
--- a/mlir/include/mlir/Transforms/Passes.h
+++ b/mlir/include/mlir/Transforms/Passes.h
@@ -32,29 +32,26 @@ class GreedyRewriteConfig;
 //===----------------------------------------------------------------------===//
 
 #define GEN_PASS_DECL_BUBBLEDOWNMEMORYSPACECASTS
-#define GEN_PASS_DECL_CSE
-#define GEN_PASS_DECL_CANONICALIZER
+#define GEN_PASS_DECL_CSEPASS
+#define GEN_PASS_DECL_CANONICALIZERPASS
 #define GEN_PASS_DECL_COMPOSITEFIXEDPOINTPASS
-#define GEN_PASS_DECL_CONTROLFLOWSINK
-#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATION
-#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTION
-#define GEN_PASS_DECL_INLINER
+#define GEN_PASS_DECL_CONTROLFLOWSINKPASS
+#define GEN_PASS_DECL_GENERATERUNTIMEVERIFICATIONPASS
+#define GEN_PASS_DECL_LOOPINVARIANTCODEMOTIONPASS
+#define GEN_PASS_DECL_LOOPINVARIANTSUBSETHOISTINGPASS
+#define GEN_PASS_DECL_INLINERPASS
 #define GEN_PASS_DECL_MEM2REG
 #define GEN_PASS_DECL_PRINTIRPASS
-#define GEN_PASS_DECL_PRINTOPSTATS
-#define GEN_PASS_DECL_REMOVEDEADVALUES
-#define GEN_PASS_DECL_SCCP
+#define GEN_PASS_DECL_PRINTOPSTATSPASS
+#define GEN_PASS_DECL_REMOVEDEADVALUESPASS
+#define GEN_PASS_DECL_SCCPPASS
 #define GEN_PASS_DECL_SROA
-#define GEN_PASS_DECL_STRIPDEBUGINFO
-#define GEN_PASS_DECL_SYMBOLDCE
-#define GEN_PASS_DECL_SYMBOLPRIVATIZE
-#define GEN_PASS_DECL_TOPOLOGICALSORT
+#define GEN_PASS_DECL_STRIPDEBUGINFOPASS
+#define GEN_PASS_DECL_SYMBOLDCEPASS
+#define GEN_PASS_DECL_SYMBOLPRIVATIZEPASS
+#define GEN_PASS_DECL_TOPOLOGICALSORTPASS
 #include "mlir/Transforms/Passes.h.inc"
 
-/// Creates an instance of the Canonicalizer pass, configured with default
-/// settings (which can be overridden by pass options on the command line).
-std::unique_ptr<Pass> createCanonicalizerPass();
-
 /// Creates an instance of the Canonicalizer pass with the specified config.
 /// `disabledPatterns` is a set of labels used to filter out input patterns with
 /// a debug label or debug name in this set. `enabledPatterns` is a set of
@@ -68,39 +65,6 @@ createCanonicalizerPass(const GreedyRewriteConfig &config,
                         ArrayRef<std::string> disabledPatterns = {},
                         ArrayRef<std::string> enabledPatterns = {});
 
-/// Creates a pass to perform control-flow sinking.
-std::unique_ptr<Pass> createControlFlowSinkPass();
-
-/// Creates a pass to perform common sub expression elimination.
-std::unique_ptr<Pass> createCSEPass();
-
-/// Creates a pass to print IR on the debug stream.
-std::unique_ptr<Pass> createPrintIRPass(const PrintIRPassOptions & = {});
-
-/// Creates a pass that generates IR to verify ops at runtime.
-std::unique_ptr<Pass> createGenerateRuntimeVerificationPass();
-
-/// Creates a loop invariant code motion pass that hoists loop invariant
-/// instructions out of the loop.
-std::unique_ptr<Pass> createLoopInvariantCodeMotionPass();
-
-/// Creates a pass that hoists loop-invariant subset ops.
-std::unique_ptr<Pass> createLoopInvariantSubsetHoistingPass();
-
-/// Creates a pass to strip debug information from a function.
-std::unique_ptr<Pass> createStripDebugInfoPass();
-
-/// Creates a pass which prints the list of ops and the number of occurrences in
-/// the module.
-std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os = llvm::errs());
-
-/// Creates a pass which prints the list of ops and the number of occurrences in
-/// the module with the output format option.
-std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
-
-/// Creates a pass which inlines calls and callable operations as defined by
-/// the CallGraph.
-std::unique_ptr<Pass> createInlinerPass();
 /// Creates an instance of the inliner pass, and use the provided pass managers
 /// when optimizing callable operations with names matching the key type.
 /// Callable operations with a name not within the provided map will use the
@@ -115,26 +79,13 @@ std::unique_ptr<Pass>
 createInlinerPass(llvm::StringMap<OpPassManager> opPipelines,
                   std::function<void(OpPassManager &)> defaultPipelineBuilder);
 
-/// Creates an optimization pass to remove dead values.
-std::unique_ptr<Pass> createRemoveDeadValuesPass();
-
-/// Creates a pass which performs sparse conditional constant propagation over
-/// nested operations.
-std::unique_ptr<Pass> createSCCPPass();
-
-/// Creates a pass which delete symbol operations that are unreachable. This
-/// pass may *only* be scheduled on an operation that defines a SymbolTable.
-std::unique_ptr<Pass> createSymbolDCEPass();
-
-/// Creates a pass which marks top-level symbol operations as `private` unless
-/// listed in `excludeSymbols`.
-std::unique_ptr<Pass>
-createSymbolPrivatizePass(ArrayRef<std::string> excludeSymbols = {});
+/// Creates a pass which prints the list of ops and the number of occurrences in
+/// the module.
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os);
 
-/// Creates a pass that recursively sorts nested regions without SSA dominance
-/// topologically such that, as much as possible, users of values appear after
-/// their producers.
-std::unique_ptr<Pass> createTopologicalSortPass();
+/// Creates a pass which prints the list of ops and the number of occurrences in
+/// the module with the output format option.
+std::unique_ptr<Pass> createPrintOpStatsPass(raw_ostream &os, bool printAsJSON);
 
 /// Create composite pass, which runs provided set of passes until fixed point
 /// or maximum number of iterations reached.
diff --git a/mlir/include/mlir/Transforms/Passes.td b/mlir/include/mlir/Transforms/Passes.td
index fc2d60d198cd6..20af90e56ee67 100644
--- a/mlir/include/mlir/Transforms/Passes.td
+++ b/mlir/include/mlir/Transforms/Passes.td
@@ -16,7 +16,7 @@
 include "mlir/Pass/PassBase.td"
 include "mlir/Rewrite/PassUtil.td"
 
-def Canonicalizer : Pass<"canonicalize"> {
+def CanonicalizerPass : Pass<"canonicalize"> {
   let summary = "Canonicalize operations";
   let description = [{
     This pass performs various types of canonicalizations over a set of
@@ -27,7 +27,6 @@ def Canonicalizer : Pass<"canonicalize"> {
     pass. See [Operation Canonicalization](Canonicalization.md) for more
     details.
   }];
-  let constructor = "mlir::createCanonicalizerPass()";
   let options = [
     Option<"topDownProcessingEnabled", "top-down", "bool",
            /*default=*/"true",
@@ -53,7 +52,7 @@ def Canonicalizer : Pass<"canonicalize"> {
   ] # RewritePassUtils.options;
 }
 
-def ControlFlowSink : Pass<"control-flow-sink"> {
+def ControlFlowSinkPass : Pass<"control-flow-sink"> {
   let summary = "Sink operations into conditional blocks";
   let description = [{
     This pass implements control-flow sink on operations that implement
@@ -71,13 +70,12 @@ def ControlFlowSink : Pass<"control-flow-sink"> {
     blocks: ops in unreachable blocks may prevent other operations from being
     sunk as they may contain uses of their results
   }];
-  let constructor = "::mlir::createControlFlowSinkPass()";
   let statistics = [
     Statistic<"numSunk", "num-sunk", "Number of operations sunk">,
   ];
 }
 
-def CSE : Pass<"cse"> {
+def CSEPass : Pass<"cse"> {
   let summary = "Eliminate common sub-expressions";
   let description = [{
     This pass implements a generalized algorithm for common sub-expression
@@ -86,14 +84,13 @@ def CSE : Pass<"cse"> {
     operations. See [Common subexpression elimination](https://en.wikipedia.org/wiki/Common_subexpression_elimination)
     for more general details on this optimization.
   }];
-  let constructor = "mlir::createCSEPass()";
   let statistics = [
     Statistic<"numCSE", "num-cse'd", "Number of operations CSE'd">,
     Statistic<"numDCE", "num-dce'd", "Number of operations DCE'd">
   ];
 }
 
-def RemoveDeadValues : Pass<"remove-dead-values"> {
+def RemoveDeadValuesPass : Pass<"remove-dead-values"> {
   let summary = "Remove dead values";
   let description = [{
     The goal of this pass is optimization (reducing runtime) by removing
@@ -257,7 +254,6 @@ def RemoveDeadValues : Pass<"remove-dead-values"> {
     Option<"canonicalize", "canonicalize", "bool", /*default=*/"true",
            "Canonicalize region branch ops">,
   ];
-  let constructor = "mlir::createRemoveDeadValuesPass()";
   let dependentDialects = ["ub::UBDialect"];
 }
 
@@ -267,20 +263,18 @@ def PrintIRPass : Pass<"print-ir"> {
     Print the entire IR on the debug stream. This is meant for debugging
     purposes to inspect the IR at a specific point in the pipeline.
   }];
-  let constructor = "mlir::createPrintIRPass()";
   let options = [
     Option<"label", "label", "std::string", /*default=*/"", "Label">,
   ];
 }
 
-def GenerateRuntimeVerification : Pass<"generate-runtime-verification"> {
+def GenerateRuntimeVerificationPass : Pass<"generate-runtime-verification"> {
   let summary = "Generate additional runtime op verification checks";
   let description = [{
     This pass generates op-specific runtime checks using the
     `RuntimeVerifiableOpInterface`. It can be run for debugging purposes after
     passes that are suspected to introduce faulty IR.
   }];
-  let constructor = "mlir::createGenerateRuntimeVerificationPass()";
   let options = [
     Option<"verboseLevel", "verbose-level", "unsigned", /*default=*/"1",
            "Verbosity level for runtime verification messages: "
@@ -290,9 +284,8 @@ def GenerateRuntimeVerification : Pass<"generate-runtime-verification"> {
 }
 
 
-def Inliner : Pass<"inline"> {
+def InlinerPass : Pass<"inline"> {
   let summary = "Inline function calls";
-  let constructor = "mlir::createInlinerPass()";
   let options = [
     Option<"defaultPipelineStr", "default-pipeline", "std::string",
            /*default=*/"\"canonicalize\"",
@@ -367,14 +360,12 @@ def LocationSnapshot : Pass<"snapshot-op-locations"> {
   ];
 }
 
-def LoopInvariantCodeMotion : Pass<"loop-invariant-code-motion"> {
+def LoopInvariantCodeMotionPass : Pass<"loop-invariant-code-motion"> {
   let summary = "Hoist loop invariant instructions outside of the loop";
-  let constructor = "mlir::createLoopInvariantCodeMotionPass()";
 }
 
-def LoopInvariantSubsetHoisting : Pass<"loop-invariant-subset-hoisting"> {
+def LoopInvariantSubsetHoistingPass : Pass<"loop-invariant-subset-hoisting"> {
   let summary = "Hoist loop invariant subset ops outside of the loop";
-  let constructor = "mlir::createLoopInvariantSubsetHoistingPass()";
 }
 
 def Mem2Reg : Pass<"mem2reg"> {
@@ -411,16 +402,15 @@ def Mem2Reg : Pass<"mem2reg"> {
   ];
 }
 
-def PrintOpStats : Pass<"print-op-stats"> {
+def PrintOpStatsPass : Pass<"print-op-stats"> {
   let summary = "Print statistics of operations";
-  let constructor = "mlir::createPrintOpStatsPass()";
   let options = [
     Option<"printAsJSON", "json", "bool", /*default=*/"false",
            "print the stats as JSON">
   ];
 }
 
-def SCCP : Pass<"sccp"> {
+def SCCPPass : Pass<"sccp"> {
   let summary = "Sparse Conditional Constant Propagation";
   let description = [{
     This pass implements a general algorithm for sparse conditional constant
@@ -431,7 +421,6 @@ def SCCP : Pass<"sccp"> {
     This implementation is based on the algorithm described by Wegman and Zadeck
     in [“Constant Propagation with Conditional Branches”](https://dl.acm.org/doi/10.1145/103135.103136) (1991).
   }];
-  let constructor = "mlir::createSCCPPass()";
 }
 
 def SROA : Pass<"sroa"> {
@@ -470,16 +459,15 @@ def SROA : Pass<"sroa"> {
   ];
 }
 
-def StripDebugInfo : Pass<"strip-debuginfo"> {
+def StripDebugInfoPass : Pass<"strip-debuginfo"> {
   let summary = "Strip debug info from all operations";
   let description = [{
     This pass strips the IR of any location information, by replacing all
     operation locations with [`unknown`](Dialects/Builtin.md/#unknownloc).
   }];
-  let constructor = "mlir::createStripDebugInfoPass()";
 }
 
-def SymbolDCE : Pass<"symbol-dce"> {
+def SymbolDCEPass : Pass<"symbol-dce"> {
   let summary = "Eliminate dead symbols";
   let description = [{
     This pass deletes all symbols that are found to be unreachable. This is done
@@ -519,14 +507,12 @@ def SymbolDCE : Pass<"symbol-dce"> {
     See [Symbols and SymbolTables](SymbolsAndSymbolTables.md) for more
     information on `Symbols`.
   }];
-  let constructor = "mlir::createSymbolDCEPass()";
-
   let statistics = [
     Statistic<"numDCE", "num-dce'd", "Number of symbols DCE'd">,
   ];
 }
 
-def SymbolPrivatize : Pass<"symbol-privatize"> {
+def SymbolPrivatizePass : Pass<"symbol-privatize"> {
   let summary = "Mark symbols private";
   let description = [{
     This pass marks all top-level symbols of the operation run as `private`
@@ -536,10 +522,9 @@ def SymbolPrivatize : Pass<"symbol-privatize"> {
     ListOption<"exclude", "exclude", "std::string",
        "Comma separated list of symbols that should not be marked private">
   ];
-  let constructor = "mlir::createSymbolPrivatizePass()";
 }
 
-def ViewOpGraph : Pass<"view-op-graph"> {
+def ViewOpGraphPass : Pass<"view-op-graph"> {
   let summary = "Print Graphviz visualization of an operation";
   let description = [{
     This pass prints a Graphviz graph of a module.
@@ -566,10 +551,9 @@ def ViewOpGraph : Pass<"view-op-graph"> {
     Option<"printResultTypes", "print-result-types", "bool",
             /*default=*/"true", "Print result types of operations">
   ];
-  let constructor = "mlir::createPrintOpGraphPass()";
 }
 
-def TopologicalSort : Pass<"topological-sort"> {
+def TopologicalSortPass : Pass<"topological-sort"> {
   let summary = "Sort regions without SSA dominance in topological order";
   let description = [{
     Recursively sorts all nested regions without SSA dominance in topological
@@ -583,7 +567,6 @@ def TopologicalSort : Pass<"topological-sort"> {
     regions in a stable order.
   }];
 
-  let constructor = "mlir::createTopologicalSortPass()";
 }
 
 def CompositeFixedPointPass : Pass<"composite-fixed-point-pass"> {
diff --git a/mlir/include/mlir/Transforms/ViewOpGraph.h b/mlir/include/mlir/Transforms/ViewOpGraph.h
index 523ed38fba1da..c48844a85ec83 100644
--- a/mlir/include/mlir/Transforms/ViewOpGraph.h
+++ b/mlir/include/mlir/Transforms/ViewOpGraph.h
@@ -19,11 +19,11 @@
 namespace mlir {
 class Pass;
 
-#define GEN_PASS_DECL_VIEWOPGRAPH
+#define GEN_PASS_DECL_VIEWOPGRAPHPASS
 #include "mlir/Transforms/Passes.h.inc"
 
-/// Creates a pass to print op graphs.
-std::unique_ptr<Pass> createPrintOpGraphPass(raw_ostream &os = llvm::errs());
+/// Creates a pass to print op graphs with the specified output stream.
+std::unique_ptr<Pass> createViewOpGraphPass(raw_ostream &os);
 
 } // namespace mlir
 
diff --git a/mlir/lib/Transforms/CSE.cpp b/mlir/lib/Transforms/CSE.cpp
index 8eaac308755fd..48a20655b2806 100644
--- a/mlir/lib/Transforms/CSE.cpp
+++ b/mlir/lib/Transforms/CSE.cpp
@@ -25,7 +25,7 @@
 #include <deque>
 
 namespace mlir {
-#define GEN_PASS_DEF_CSE
+#define GEN_PASS_DEF_CSEPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -384,7 +384,7 @@ void mlir::eliminateCommonSubExpressions(RewriterBase &rewriter,
 
 namespace {
 /// CSE pass.
-struct CSE : public impl::CSEBase<CSE> {
+struct CSE : public impl::CSEPassBase<CSE> {
   void runOnOperation() override;
 };
 } // namespace
@@ -408,5 +408,3 @@ void CSE::runOnOperation() {
   // preserved.
   markAnalysesPreserved<DominanceInfo, PostDominanceInfo>();
 }
-
-std::unique_ptr<Pass> mlir::createCSEPass() { return std::make_unique<CSE>(); }
diff --git a/mlir/lib/Transforms/Canonicalizer.cpp b/mlir/lib/Transforms/Canonicalizer.cpp
index 7a99fe86d09f5..9f9bad1c2a678 100644
--- a/mlir/lib/Transforms/Canonicalizer.cpp
+++ b/mlir/lib/Transforms/Canonicalizer.cpp
@@ -17,7 +17,7 @@
 #include "mlir/Transforms/GreedyPatternRewriteDriver.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_CANONICALIZER
+#define GEN_PASS_DEF_CANONICALIZERPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -25,8 +25,8 @@ using namespace mlir;
 
 namespace {
 /// Canonicalize operations in nested regions.
-struct Canonicalizer : public impl::CanonicalizerBase<Canonicalizer> {
-  Canonicalizer() = default;
+struct Canonicalizer : public impl::CanonicalizerPassBase<Canonicalizer> {
+  using impl::CanonicalizerPassBase<Canonicalizer>::CanonicalizerPassBase;
   Canonicalizer(const GreedyRewriteConfig &config,
                 ArrayRef<std::string> disabledPatterns,
                 ArrayRef<std::string> enabledPatterns)
@@ -70,11 +70,6 @@ struct Canonicalizer : public impl::CanonicalizerBase<Canonicalizer> {
 };
 } // namespace
 
-/// Create a Canonicalizer pass.
-std::unique_ptr<Pass> mlir::createCanonicalizerPass() {
-  return std::make_unique<Canonicalizer>();
-}
-
 /// Creates an instance of the Canonicalizer pass with the specified config.
 std::unique_ptr<Pass>
 mlir::createCanonicalizerPass(const GreedyRewriteConfig &config,
diff --git a/mlir/lib/Transforms/ControlFlowSink.cpp b/mlir/lib/Transforms/ControlFlowSink.cpp
index 4e1dfa1c7c83f..eed9c1cdab36d 100644
--- a/mlir/lib/Transforms/ControlFlowSink.cpp
+++ b/mlir/lib/Transforms/ControlFlowSink.cpp
@@ -21,7 +21,7 @@
 #include "mlir/Transforms/ControlFlowSinkUtils.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_CONTROLFLOWSINK
+#define GEN_PASS_DEF_CONTROLFLOWSINKPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -29,7 +29,7 @@ using namespace mlir;
 
 namespace {
 /// A control-flow sink pass.
-struct ControlFlowSink : public impl::ControlFlowSinkBase<ControlFlowSink> {
+struct ControlFlowSink : public impl::ControlFlowSinkPassBase<ControlFlowSink> {
   void runOnOperation() override;
 };
 } // end anonymous namespace
@@ -52,7 +52,3 @@ void ControlFlowSink::runOnOperation() {
         });
   });
 }
-
-std::unique_ptr<Pass> mlir::createControlFlowSinkPass() {
-  return std::make_unique<ControlFlowSink>();
-}
diff --git a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
index 1e226c03972b0..29512a5eebcc5 100644
--- a/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
+++ b/mlir/lib/Transforms/GenerateRuntimeVerification.cpp
@@ -14,7 +14,7 @@
 #include "mlir/Interfaces/RuntimeVerifiableOpInterface.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_GENERATERUNTIMEVERIFICATION
+#define GEN_PASS_DEF_GENERATERUNTIMEVERIFICATIONPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -22,8 +22,10 @@ using namespace mlir;
 
 namespace {
 struct GenerateRuntimeVerificationPass
-    : public impl::GenerateRuntimeVerificationBase<
+    : public impl::GenerateRuntimeVerificationPassBase<
           GenerateRuntimeVerificationPass> {
+  using impl::GenerateRuntimeVerificationPassBase<
+      GenerateRuntimeVerificationPass>::GenerateRuntimeVerificationPassBase;
   void runOnOperation() override;
 };
 
@@ -99,7 +101,3 @@ void GenerateRuntimeVerificationPass::runOnOperation() {
                                              defaultErrMsgGenerator);
   };
 }
-
-std::unique_ptr<Pass> mlir::createGenerateRuntimeVerificationPass() {
-  return std::make_unique<GenerateRuntimeVerificationPass>();
-}
diff --git a/mlir/lib/Transforms/InlinerPass.cpp b/mlir/lib/Transforms/InlinerPass.cpp
index 77a9e6cbd8c9f..423aad316be0d 100644
--- a/mlir/lib/Transforms/InlinerPass.cpp
+++ b/mlir/lib/Transforms/InlinerPass.cpp
@@ -21,7 +21,7 @@
 #include "llvm/Support/DebugLog.h"
 
 namespace mlir {
-#define GEN_PASS_DEF_INLINER
+#define GEN_PASS_DEF_INLINERPASS
 #include "mlir/Transforms/Passes.h.inc"
 } // namespace mlir
 
@@ -39,8 +39,9 @@ static void defaultInlinerOptPipeline(OpPassManager &pm) {
 //===----------------------------------------------------------------------===//
 
 namespace {
-class InlinerPass : public impl::InlinerBase<InlinerPass> {
+class InlinerPass : public impl::InlinerPassBase<InlinerPass> {
 public:
+  using impl::InlinerPassBase<InlinerPass>::InlinerPassBase;
   InlinerPass();
   InlinerPass(const InlinerPass &) = default;
   InlinerPass(std::function<void(OpPassManager &)> defaultPipeline);
@@ -183,9 +184,6 @@ LogicalResult InlinerPass::initializeOptions(
   return success();
 }
 
-std::unique_ptr<Pass> mlir::createInlinerPass() {
-  return std::make_unique<InlinerPass>();
-}
 std::unique_ptr<Pass>
 mlir::createInlinerPass(llvm::StringMap<OpPassManager> opPipelines) {
   return std::make_unique<InlinerPass>(defaultInlinerOptPipeline,
diff --git a/mlir/lib/Transforms/LoopInvariantCodeMo...
[truncated]

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2026

🪟 Windows x64 Test Results

  • 3487 tests passed
  • 414 tests skipped

✅ The build succeeded and all tests passed.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Feb 28, 2026

🐧 Linux x64 Test Results

  • 7543 tests passed
  • 601 tests skipped

✅ The build succeeded and all tests passed.

…Passes.td

This makes the constructor auto-generated.
@joker-eph joker-eph merged commit 785490e into llvm:main Mar 1, 2026
10 checks passed
sahas3 pushed a commit to sahas3/llvm-project that referenced this pull request Mar 4, 2026
…Passes.td (llvm#183950)

This makes the constructor auto-generated.
sujianIBM pushed a commit to sujianIBM/llvm-project that referenced this pull request Mar 5, 2026
…Passes.td (llvm#183950)

This makes the constructor auto-generated.
modularbot pushed a commit to modular/modular that referenced this pull request Mar 7, 2026
Changes:
- Renamed MLIR pass registration functions to include `Pass` suffix
(`registerCanonicalizerPass`, `registerStripDebugInfoPass`, etc.)
following
upstream
[785490e9db54](llvm/llvm-project@785490e)
  ([#183950](llvm/llvm-project#183950))
- Updated `llvm-lldb-exports.patch` for upstream LLDBLog refactoring:
- `InitializeLldbChannel` renamed to
`InitializeLLDBChannel`/`TerminateLLDBChannel`
([d4d18248](llvm/llvm-project@d4d18248fde6))
  - Functions then wrapped in `LLDBLogChannel` class
([45dbce3a](llvm/llvm-project@45dbce3a3a3e))
- Fix `executeFromDriver` to accept non-const `SmallVectorImpl` after
  `MutableArrayRef` stopped accepting const container sources
  ([c88ba88d](llvm/llvm-project@c88ba88da52b))
- Fix MGP dialect tests: add return types to `func.func` declarations
  now that MLIR's `FuncOp` verifier checks `ReturnLike` ops (including
  `mef.output`) against declared return types, following upstream

[b28ec5ad1808](llvm/llvm-project@b28ec5a)
  ([#184612](llvm/llvm-project#184612))
- Fix GCN FileCheck patterns for AMDGPU `@llvm.amdgcn.implicitarg.ptr()`
now emitting `dereferenceable(256)` return attribute, following upstream

[fdc4a982f5d6](llvm/llvm-project@fdc4a982f5d6)
  ([#182206](llvm/llvm-project#182206))
- Update GCN shuffle test FileCheck patterns for LLVM optimizer
improvements:
`and`-mask simplifications (e.g. `and i32 %5, -64` → `and i32 %5, 64`)
and
`add nuw nsw` flag additions, enabled by upstream KnownBits analysis for
  `mbcnt_lo`/`mbcnt_hi` intrinsics in

[686987a540bc](llvm/llvm-project@686987a)
  ([#183229](llvm/llvm-project#183229))
- Fix GEP element type FileCheck patterns: InstCombine now canonicalizes
GEP element types to byte arrays (`float` → `[4 x i8]`, `i64` → `[8 x
i8]`)
- Fix `mo.while` body type mismatch error message: MLIR's
  `RegionBranchOpInterface` (`verifyWithRegions`) now detects yield type
mismatches before `LoopLikeOpInterface`, emitting a different
diagnostic,
  following upstream

[b28ec5ad1808](llvm/llvm-project@b28ec5a)
- Regenerate MLIR Python binding stubs

MODULAR_ORIG_COMMIT_REV_ID: acd27a457aa9115fd91f73d7ba3338365ece3eb4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mlir:core MLIR Core Infrastructure mlir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants