Skip to content

Commit 4408613

Browse files
authored
[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.
1 parent 8a3537b commit 4408613

File tree

4 files changed

+1
-14
lines changed

4 files changed

+1
-14
lines changed

flang/include/flang/Optimizer/HLFIR/Passes.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ namespace hlfir {
2424

2525
std::unique_ptr<mlir::Pass> createConvertHLFIRtoFIRPass();
2626
std::unique_ptr<mlir::Pass> createBufferizeHLFIRPass();
27-
std::unique_ptr<mlir::Pass> createLowerHLFIRIntrinsicsPass();
2827

2928
#define GEN_PASS_REGISTRATION
3029
#include "flang/Optimizer/HLFIR/Passes.h.inc"

flang/include/flang/Optimizer/HLFIR/Passes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ def OptimizedBufferization : Pass<"opt-bufferization"> {
2929

3030
def LowerHLFIRIntrinsics : Pass<"lower-hlfir-intrinsics", "::mlir::ModuleOp"> {
3131
let summary = "Lower HLFIR transformational intrinsic operations";
32-
let constructor = "hlfir::createLowerHLFIRIntrinsicsPass()";
3332
}
3433

3534
def LowerHLFIROrderedAssignments : Pass<"lower-hlfir-ordered-assignments", "::mlir::ModuleOp"> {

flang/include/flang/Tools/CLOptions.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ inline void createHLFIRToFIRPassPipeline(
328328
pm, hlfir::createOptimizedBufferization);
329329
}
330330
pm.addPass(hlfir::createLowerHLFIROrderedAssignments());
331-
pm.addPass(hlfir::createLowerHLFIRIntrinsicsPass());
331+
pm.addPass(hlfir::createLowerHLFIRIntrinsics());
332332
pm.addPass(hlfir::createBufferizeHLFIRPass());
333333
pm.addPass(hlfir::createConvertHLFIRtoFIRPass());
334334
}

flang/lib/Optimizer/HLFIR/Transforms/LowerHLFIRIntrinsics.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -468,13 +468,6 @@ class LowerHLFIRIntrinsics
468468
: public hlfir::impl::LowerHLFIRIntrinsicsBase<LowerHLFIRIntrinsics> {
469469
public:
470470
void runOnOperation() override {
471-
// TODO: make this a pass operating on FuncOp. The issue is that
472-
// FirOpBuilder helpers may generate new FuncOp because of runtime/llvm
473-
// intrinsics calls creation. This may create race conflict if the pass is
474-
// scheduled on FuncOp. A solution could be to provide an optional mutex
475-
// when building a FirOpBuilder and locking around FuncOp and GlobalOp
476-
// creation, but this needs a bit more thinking, so at this point the pass
477-
// is scheduled on the moduleOp.
478471
mlir::ModuleOp module = this->getOperation();
479472
mlir::MLIRContext *context = &getContext();
480473
mlir::RewritePatternSet patterns(context);
@@ -504,7 +497,3 @@ class LowerHLFIRIntrinsics
504497
}
505498
};
506499
} // namespace
507-
508-
std::unique_ptr<mlir::Pass> hlfir::createLowerHLFIRIntrinsicsPass() {
509-
return std::make_unique<LowerHLFIRIntrinsics>();
510-
}

0 commit comments

Comments
 (0)