[Mlir-commits] [mlir] [mlir] Remove loop peeling explicit C'tor (PR #175419)
ofri frishman
llvmlistbot at llvm.org
Sun Jan 11 01:05:39 PST 2026
https://github.com/ofri-frishman created https://github.com/llvm/llvm-project/pull/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.
>From f4eb1a3f1695ca53e6d5292cbac6611d556b3fe9 Mon Sep 17 00:00:00 2001
From: Ofri Frishman <ofri4321 at gmail.com>
Date: Sun, 11 Jan 2026 10:33:34 +0200
Subject: [PATCH] [mlir] Remove loop peeling explicit C'tor
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.
---
mlir/include/mlir/Dialect/SCF/Transforms/Passes.h | 4 ----
mlir/include/mlir/Dialect/SCF/Transforms/Passes.td | 1 -
mlir/lib/Dialect/SCF/Transforms/LoopSpecialization.cpp | 6 ++----
3 files changed, 2 insertions(+), 9 deletions(-)
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