[Mlir-commits] [mlir] 7889ff7 - [mlir] Finish removing FunctionPass

River Riddle llvmlistbot at llvm.org
Mon Feb 7 19:40:33 PST 2022


Author: River Riddle
Date: 2022-02-07T19:04:52-08:00
New Revision: 7889ff7f0008500710fd84838b66d5022c7acb2a

URL: https://github.com/llvm/llvm-project/commit/7889ff7f0008500710fd84838b66d5022c7acb2a
DIFF: https://github.com/llvm/llvm-project/commit/7889ff7f0008500710fd84838b66d5022c7acb2a.diff

LOG: [mlir] Finish removing FunctionPass

FunctionPass has been deprecated in favor of OperationPass<FuncOp>
for a few weeks, and this commit finished the deprecation with deletion.
The only difference between the two is that FunctionPass filters out function
declarations. When updating references to FunctionPass, ensure that
the pass either can handle declarations or explicitly add in filtering.

See https://llvm.discourse.group/t/functionpass-deprecated-in-favor-of-operationpass-funcop

Differential Revision: https://reviews.llvm.org/D118735

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/SCF/Utils/Utils.h
    mlir/include/mlir/Pass/Pass.h
    mlir/include/mlir/Pass/PassBase.td

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
index 6f700b4845746..04ccd1a05b4ac 100644
--- a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
+++ b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h
@@ -63,7 +63,7 @@ scf::ForOp cloneWithNewYields(OpBuilder &b, scf::ForOp loop,
 /// single block. This constraint makes it easy to determine the result.
 /// This method also clones the `arith::ConstantIndexOp` at the start of
 /// `outlinedFuncBody` to alloc simple canonicalizations.
-/// Creates a new FuncOp and thus cannot be used in a FunctionPass.
+/// Creates a new FuncOp and thus cannot be used in a FuncOp pass.
 /// The client is responsible for providing a unique `funcName` that will not
 /// collide with another FuncOp name.
 // TODO: support more than single-block regions.
@@ -76,7 +76,7 @@ FailureOr<FuncOp> outlineSingleBlockRegion(RewriterBase &rewriter, Location loc,
 ///    region is inlined into a new FuncOp that is captured by the pointer.
 ///  - if `elseFn` is not null, `elseFnName` must be specified and the `else`
 ///    region is inlined into a new FuncOp that is captured by the pointer.
-/// Creates new FuncOps and thus cannot be used in a FunctionPass.
+/// Creates new FuncOps and thus cannot be used in a FuncOp pass.
 /// The client is responsible for providing a unique `thenFnName`/`elseFnName`
 /// that will not collide with another FuncOp name.
 LogicalResult outlineIfOp(RewriterBase &b, scf::IfOp ifOp, FuncOp *thenFn,

diff  --git a/mlir/include/mlir/Pass/Pass.h b/mlir/include/mlir/Pass/Pass.h
index ebc92414e6175..9b67491993c35 100644
--- a/mlir/include/mlir/Pass/Pass.h
+++ b/mlir/include/mlir/Pass/Pass.h
@@ -375,35 +375,6 @@ template <> class OperationPass<void> : public Pass {
   OperationPass(const OperationPass &) = default;
 };
 
-/// NOTICE: This class is deprecated in favor of `OperationPass<FuncOp>`
-/// and will be removed soon.
-/// A model for providing function pass specific utilities.
-///
-/// Derived function passes are expected to provide the following:
-///   - A 'void runOnFunction()' method.
-///   - A 'StringRef getName() const' method.
-///   - A 'std::unique_ptr<Pass> clonePass() const' method.
-class [[deprecated(
-    "Use OperationPass<FuncOp> instead: See "
-    "https://llvm.discourse.group/t/"
-    "functionpass-deprecated-in-favor-of-operationpass-funcop")]] FunctionPass
-    : public OperationPass<FuncOp> {
-public:
-  using OperationPass<FuncOp>::OperationPass;
-
-  /// The polymorphic API that runs the pass over the currently held function.
-  virtual void runOnFunction() = 0;
-
-  /// The polymorphic API that runs the pass over the currently held operation.
-  void runOnOperation() final {
-    if (!getFunction().isExternal())
-      runOnFunction();
-  }
-
-  /// Return the current function being transformed.
-  FuncOp getFunction() { return this->getOperation(); }
-};
-
 /// This class provides a CRTP wrapper around a base pass class to define
 /// several necessary utility methods. This should only be used for passes that
 /// are not suitably represented using the declarative pass specification(i.e.

diff  --git a/mlir/include/mlir/Pass/PassBase.td b/mlir/include/mlir/Pass/PassBase.td
index e075fb99e41f2..64ef988fdf941 100644
--- a/mlir/include/mlir/Pass/PassBase.td
+++ b/mlir/include/mlir/Pass/PassBase.td
@@ -92,9 +92,4 @@ class PassBase<string passArg, string base> {
 class Pass<string passArg, string operation = "">
   : PassBase<passArg, "::mlir::OperationPass<" # operation # ">">;
 
-/// NOTICE: This class is deprecated in favor of `Pass<..., "mlir::FuncOp">`
-/// and will be removed soon.
-// This class represents an mlir::FunctionPass.
-class FunctionPass<string passArg> : PassBase<passArg, "::mlir::FunctionPass">;
-
 #endif // MLIR_PASS_PASSBASE


        


More information about the Mlir-commits mailing list