[Mlir-commits] [mlir] 6559bda - [mlir] Remove loop peeling explicit C'tor (#175419)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun Jan 11 01:59:10 PST 2026


Author: ofri frishman
Date: 2026-01-11T11:59:05+02:00
New Revision: 6559bdab615442a5e08992bfbe310d94cf6f5be2

URL: https://github.com/llvm/llvm-project/commit/6559bdab615442a5e08992bfbe310d94cf6f5be2
DIFF: https://github.com/llvm/llvm-project/commit/6559bdab615442a5e08992bfbe310d94cf6f5be2.diff

LOG: [mlir] Remove loop peeling explicit C'tor (#175419)

The SCF dialect loop peeling pass has an explicit C'tor. This creates an
inconvenience to use non default pass options, since they can only be
passed as a string after the pass creation. After removing the explicit
C'tor, the code auto generation creates 2 C'tors, which one of them can
directly receive pass options struct in case non default values are
required.
The explicit C'tor does not match auto generated C'tor convention, so
this change requires any uses of the pass in downstream projects to
update to use the auto generated C'tor.

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
    mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
    mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
index 54b0118507184..e5794dbfeabae 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.h
@@ -24,10 +24,6 @@ namespace mlir {
 /// vectorization.
 std::unique_ptr<Pass> createForLoopSpecializationPass();
 
-/// Creates a pass that peels for loops at their upper bounds for
-/// better vectorization.
-std::unique_ptr<Pass> createForLoopPeelingPass();
-
 /// Creates a pass that canonicalizes affine.min and affine.max operations
 /// inside of scf.for loops with known lower and upper bounds.
 std::unique_ptr<Pass> createSCFForLoopCanonicalizationPass();

diff  --git a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
index 3ac651f53880c..44e523fdfb8fe 100644
--- a/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
+++ b/mlir/include/mlir/Dialect/SCF/Transforms/Passes.td
@@ -23,7 +23,6 @@ def SCFForLoopCanonicalization
 
 def SCFForLoopPeeling : Pass<"scf-for-loop-peeling"> {
   let summary = "Peel `for` loops at their upper bounds.";
-  let constructor = "mlir::createForLoopPeelingPass()";
   let options = [
     Option<"peelFront", "peel-front", "bool",
            /*default=*/"false",

diff  --git a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
index c7588b433dee1..cff01d1de17e8 100644
--- a/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
+++ b/mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp
@@ -337,6 +337,8 @@ struct ForLoopSpecialization
 };
 
 struct ForLoopPeeling : public impl::SCFForLoopPeelingBase<ForLoopPeeling> {
+  using impl::SCFForLoopPeelingBase<ForLoopPeeling>::SCFForLoopPeelingBase;
+
   void runOnOperation() override {
     auto *parentOp = getOperation();
     MLIRContext *ctx = parentOp->getContext();
@@ -360,7 +362,3 @@ std::unique_ptr<Pass> mlir::createParallelLoopSpecializationPass() {
 std::unique_ptr<Pass> mlir::createForLoopSpecializationPass() {
   return std::make_unique<ForLoopSpecialization>();
 }
-
-std::unique_ptr<Pass> mlir::createForLoopPeelingPass() {
-  return std::make_unique<ForLoopPeeling>();
-}


        


More information about the Mlir-commits mailing list