[flang-commits] [flang] [flang][NFC] Use tablegen to create SimplifyIntrinsics constructor (PR #89963)
Tom Eccles via flang-commits
flang-commits at lists.llvm.org
Wed Apr 24 10:55:24 PDT 2024
https://github.com/tblah created https://github.com/llvm/llvm-project/pull/89963
This pass runs on ModuleOp, internally walking all func::CallOps so it shouldn't need anything special to work on other top level operations.
>From 8a2cb840d7e97efbe3fefa5e4cc3f5c189d36f3e Mon Sep 17 00:00:00 2001
From: Tom Eccles <tom.eccles at arm.com>
Date: Wed, 24 Apr 2024 17:47:58 +0000
Subject: [PATCH] [flang][NFC] Use tablegen to create SimplifyIntrinsics
constructor
This pass runs on ModuleOp, internally walking all func::CallOps so it
shouldn't need anything special to work on other top level operations.
---
flang/include/flang/Optimizer/Transforms/Passes.h | 1 -
flang/include/flang/Optimizer/Transforms/Passes.td | 1 -
flang/include/flang/Tools/CLOptions.inc | 2 +-
flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp | 6 +++---
4 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 402f212387e41d..0a958244debec6 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -61,7 +61,6 @@ std::unique_ptr<mlir::Pass> createPromoteToAffinePass();
std::unique_ptr<mlir::Pass> createMemoryAllocationPass();
std::unique_ptr<mlir::Pass> createStackArraysPass();
std::unique_ptr<mlir::Pass> createAliasTagsPass();
-std::unique_ptr<mlir::Pass> createSimplifyIntrinsicsPass();
std::unique_ptr<mlir::Pass>
createAddDebugInfoPass(fir::AddDebugInfoOptions options = {});
std::unique_ptr<mlir::Pass> createLoopVersioningPass();
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index 88e4321e5b2bcb..c2f0e7d394c4a7 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -225,7 +225,6 @@ def SimplifyIntrinsics : Pass<"simplify-intrinsics", "mlir::ModuleOp"> {
simplified function. The simplified function is added to the current module.
This function can be inlined by a general purpose inlining pass.
}];
- let constructor = "::fir::createSimplifyIntrinsicsPass()";
let options = [
Option<"enableExperimental", "enable-experimental", "bool",
diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc
index a9d8ebc84e2e10..5fc312249f5e5b 100644
--- a/flang/include/flang/Tools/CLOptions.inc
+++ b/flang/include/flang/Tools/CLOptions.inc
@@ -248,7 +248,7 @@ inline void createDefaultFIROptimizerPassPipeline(
pm.addPass(fir::createSimplifyRegionLitePass());
if (pc.OptLevel.isOptimizingForSpeed()) {
// These passes may increase code size.
- pm.addPass(fir::createSimplifyIntrinsicsPass());
+ pm.addPass(fir::createSimplifyIntrinsics());
pm.addPass(fir::createAlgebraicSimplificationPass(config));
}
diff --git a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
index f7820b6b8170ba..a4f2f5238e4038 100644
--- a/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
+++ b/flang/lib/Optimizer/Transforms/SimplifyIntrinsics.cpp
@@ -72,6 +72,9 @@ class SimplifyIntrinsicsPass
mlir::Type elementType)>;
public:
+ using fir::impl::SimplifyIntrinsicsBase<
+ SimplifyIntrinsicsPass>::SimplifyIntrinsicsBase;
+
/// Generate a new function implementing a simplified version
/// of a Fortran runtime function defined by \p basename name.
/// \p typeGenerator is a callback that generates the new function's type.
@@ -1387,6 +1390,3 @@ void SimplifyIntrinsicsPass::getDependentDialects(
// LLVM::LinkageAttr creation requires that LLVM dialect is loaded.
registry.insert<mlir::LLVM::LLVMDialect>();
}
-std::unique_ptr<mlir::Pass> fir::createSimplifyIntrinsicsPass() {
- return std::make_unique<SimplifyIntrinsicsPass>();
-}
More information about the flang-commits
mailing list