[flang-commits] [flang] 4408613 - [flang][HLFIR][NFC] Reduce intrinsic lowering pass boilerplate (#93062)
via flang-commits
flang-commits at lists.llvm.org
Thu May 23 02:28:10 PDT 2024
Author: Tom Eccles
Date: 2024-05-23T10:28:06+01:00
New Revision: 44086133c53599c3aaa7f93426bffdc2ef6cb42a
URL: https://github.com/llvm/llvm-project/commit/44086133c53599c3aaa7f93426bffdc2ef6cb42a
DIFF: https://github.com/llvm/llvm-project/commit/44086133c53599c3aaa7f93426bffdc2ef6cb42a.diff
LOG: [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.
Added:
Modified:
flang/include/flang/Optimizer/HLFIR/Passes.h
flang/include/flang/Optimizer/HLFIR/Passes.td
flang/include/flang/Tools/CLOptions.inc
flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp
Removed:
################################################################################
diff --git a/flang/include/flang/Optimizer/HLFIR/Passes.h b/flang/include/flang/Optimizer/HLFIR/Passes.h
index e0b4111eed6bf..4fa619cd53ca9 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 9555467a57adc..fc3d2a0d46819 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 69934281fa992..56cc9da7de0dd 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 e9dbb7095d0eb..707c0feffbb36 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 @@ class LowerHLFIRIntrinsics
}
};
} // namespace
-
-std::unique_ptr<mlir::Pass> hlfir::createLowerHLFIRIntrinsicsPass() {
- return std::make_unique<LowerHLFIRIntrinsics>();
-}
More information about the flang-commits
mailing list