From 7889ff7f0008500710fd84838b66d5022c7acb2a Mon Sep 17 00:00:00 2001 From: River Riddle Date: Tue, 1 Feb 2022 13:27:46 -0800 Subject: [PATCH] [mlir] Finish removing FunctionPass FunctionPass has been deprecated in favor of OperationPass 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 --- mlir/include/mlir/Dialect/SCF/Utils/Utils.h | 4 ++-- mlir/include/mlir/Pass/Pass.h | 29 ----------------------------- mlir/include/mlir/Pass/PassBase.td | 5 ----- 3 files changed, 2 insertions(+), 36 deletions(-) diff --git a/mlir/include/mlir/Dialect/SCF/Utils/Utils.h b/mlir/include/mlir/Dialect/SCF/Utils/Utils.h index 6f700b4..04ccd1a 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 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 ebc9241..9b67491 100644 --- a/mlir/include/mlir/Pass/Pass.h +++ b/mlir/include/mlir/Pass/Pass.h @@ -375,35 +375,6 @@ protected: OperationPass(const OperationPass &) = default; }; -/// NOTICE: This class is deprecated in favor of `OperationPass` -/// 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 clonePass() const' method. -class [[deprecated( - "Use OperationPass instead: See " - "https://llvm.discourse.group/t/" - "functionpass-deprecated-in-favor-of-operationpass-funcop")]] FunctionPass - : public OperationPass { -public: - using OperationPass::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 e075fb9..64ef988 100644 --- a/mlir/include/mlir/Pass/PassBase.td +++ b/mlir/include/mlir/Pass/PassBase.td @@ -92,9 +92,4 @@ class PassBase { class Pass : PassBase">; -/// NOTICE: This class is deprecated in favor of `Pass<..., "mlir::FuncOp">` -/// and will be removed soon. -// This class represents an mlir::FunctionPass. -class FunctionPass : PassBase; - #endif // MLIR_PASS_PASSBASE -- 2.7.4