diff options
author | Tom Eccles <tom.eccles@arm.com> | 2024-05-23 10:28:06 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-23 10:28:06 +0100 |
commit | 44086133c53599c3aaa7f93426bffdc2ef6cb42a (patch) | |
tree | 3f44ddfda1bd765d6ab2773fcedb4663038e719d | |
parent | 8a3537bfefa295e12ddbdb59cb8f76281ce302a0 (diff) | |
download | llvm-44086133c53599c3aaa7f93426bffdc2ef6cb42a.zip llvm-44086133c53599c3aaa7f93426bffdc2ef6cb42a.tar.gz llvm-44086133c53599c3aaa7f93426bffdc2ef6cb42a.tar.bz2 |
[flang][HLFIR][NFC] Reduce intrinsic lowering pass boilerplate (#93062)
The pass constructor can be generated automatically.
This pass is module-level and then runs on all relevant intrinsic
operations inside of the module, no matter what top level operation they
are inside of.
-rw-r--r-- | flang/include/flang/Optimizer/HLFIR/Passes.h | 1 | ||||
-rw-r--r-- | flang/include/flang/Optimizer/HLFIR/Passes.td | 1 | ||||
-rw-r--r-- | flang/include/flang/Tools/CLOptions.inc | 2 | ||||
-rw-r--r-- | flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp | 11 |
4 files changed, 1 insertions, 14 deletions
diff --git a/flang/include/flang/Optimizer/HLFIR/Passes.h b/flang/include/flang/Optimizer/HLFIR/Passes.h index e0b4111..4fa619c 100644 --- a/flang/include/flang/Optimizer/HLFIR/Passes.h +++ b/flang/include/flang/Optimizer/HLFIR/Passes.h @@ -24,7 +24,6 @@ namespace hlfir { std::unique_ptr<mlir::Pass> createConvertHLFIRtoFIRPass(); std::unique_ptr<mlir::Pass> createBufferizeHLFIRPass(); -std::unique_ptr<mlir::Pass> createLowerHLFIRIntrinsicsPass(); #define GEN_PASS_REGISTRATION #include "flang/Optimizer/HLFIR/Passes.h.inc" diff --git a/flang/include/flang/Optimizer/HLFIR/Passes.td b/flang/include/flang/Optimizer/HLFIR/Passes.td index 9555467..fc3d2a0 100644 --- a/flang/include/flang/Optimizer/HLFIR/Passes.td +++ b/flang/include/flang/Optimizer/HLFIR/Passes.td @@ -29,7 +29,6 @@ def OptimizedBufferization : Pass<"opt-bufferization"> { def LowerHLFIRIntrinsics : Pass<"lower-hlfir-intrinsics", "::mlir::ModuleOp"> { let summary = "Lower HLFIR transformational intrinsic operations"; - let constructor = "hlfir::createLowerHLFIRIntrinsicsPass()"; } def LowerHLFIROrderedAssignments : Pass<"lower-hlfir-ordered-assignments", "::mlir::ModuleOp"> { diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc index 6993428..56cc9da 100644 --- a/flang/include/flang/Tools/CLOptions.inc +++ b/flang/include/flang/Tools/CLOptions.inc @@ -328,7 +328,7 @@ inline void createHLFIRToFIRPassPipeline( pm, hlfir::createOptimizedBufferization); } pm.addPass(hlfir::createLowerHLFIROrderedAssignments()); - pm.addPass(hlfir::createLowerHLFIRIntrinsicsPass()); + pm.addPass(hlfir::createLowerHLFIRIntrinsics()); pm.addPass(hlfir::createBufferizeHLFIRPass()); pm.addPass(hlfir::createConvertHLFIRtoFIRPass()); } diff --git a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp index e9dbb70..707c0fe 100644 --- a/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp +++ b/flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp @@ -468,13 +468,6 @@ class LowerHLFIRIntrinsics : public hlfir::impl::LowerHLFIRIntrinsicsBase<LowerHLFIRIntrinsics> { public: void runOnOperation() override { - // TODO: make this a pass operating on FuncOp. The issue is that - // FirOpBuilder helpers may generate new FuncOp because of runtime/llvm - // intrinsics calls creation. This may create race conflict if the pass is - // scheduled on FuncOp. A solution could be to provide an optional mutex - // when building a FirOpBuilder and locking around FuncOp and GlobalOp - // creation, but this needs a bit more thinking, so at this point the pass - // is scheduled on the moduleOp. mlir::ModuleOp module = this->getOperation(); mlir::MLIRContext *context = &getContext(); mlir::RewritePatternSet patterns(context); @@ -504,7 +497,3 @@ public: } }; } // namespace - -std::unique_ptr<mlir::Pass> hlfir::createLowerHLFIRIntrinsicsPass() { - return std::make_unique<LowerHLFIRIntrinsics>(); -} |