diff options
author | Tom Eccles <tom.eccles@arm.com> | 2024-06-03 10:16:10 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-03 10:16:10 +0100 |
commit | 6a217307641972e27f9eee1adb80e649e10f229f (patch) | |
tree | e8ac59a645149c4b8cd3edfbed845b65038bf5cc | |
parent | 8918d35dbde126c95350b674a2bb102692d90260 (diff) | |
download | llvm-6a217307641972e27f9eee1adb80e649e10f229f.zip llvm-6a217307641972e27f9eee1adb80e649e10f229f.tar.gz llvm-6a217307641972e27f9eee1adb80e649e10f229f.tar.bz2 |
[flang][OpenMP][NFC] Reduce FunctionFiltering pass boilerplate (#93951)
The pass constructor can be generated automatically.
This pass doesn't need to be adapted to support other top level
operations because it is specifically supposed to filter functions. We
don't need to filter non-function top level operations because without
use inside of functions they shouldn't lead to any codegen.
4 files changed, 2 insertions, 8 deletions
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h index 46c38d1..a7ba704 100644 --- a/flang/include/flang/Optimizer/Transforms/Passes.h +++ b/flang/include/flang/Optimizer/Transforms/Passes.h @@ -53,6 +53,7 @@ namespace fir { #define GEN_PASS_DECL_ADDALIASTAGS #define GEN_PASS_DECL_OMPMAPINFOFINALIZATIONPASS #define GEN_PASS_DECL_OMPMARKDECLARETARGETPASS +#define GEN_PASS_DECL_OMPFUNCTIONFILTERING #include "flang/Optimizer/Transforms/Passes.h.inc" std::unique_ptr<mlir::Pass> createAffineDemotionPass(); @@ -72,8 +73,6 @@ std::unique_ptr<mlir::Pass> createAlgebraicSimplificationPass(); std::unique_ptr<mlir::Pass> createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config); -std::unique_ptr<mlir::Pass> createOMPFunctionFilteringPass(); - std::unique_ptr<mlir::Pass> createVScaleAttrPass(); std::unique_ptr<mlir::Pass> createVScaleAttrPass(std::pair<unsigned, unsigned> vscaleAttr); diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td index f034128..8263820 100644 --- a/flang/include/flang/Optimizer/Transforms/Passes.td +++ b/flang/include/flang/Optimizer/Transforms/Passes.td @@ -343,7 +343,6 @@ def OMPMarkDeclareTargetPass def OMPFunctionFiltering : Pass<"omp-function-filtering"> { let summary = "Filters out functions intended for the host when compiling " "for the target device."; - let constructor = "::fir::createOMPFunctionFilteringPass()"; let dependentDialects = [ "mlir::func::FuncDialect", "fir::FIROpsDialect" diff --git a/flang/include/flang/Tools/CLOptions.inc b/flang/include/flang/Tools/CLOptions.inc index e0141a3..cca3344 100644 --- a/flang/include/flang/Tools/CLOptions.inc +++ b/flang/include/flang/Tools/CLOptions.inc @@ -349,7 +349,7 @@ inline void createOpenMPFIRPassPipeline( pm, fir::createOMPMapInfoFinalizationPass); pm.addPass(fir::createOMPMarkDeclareTargetPass()); if (isTargetDevice) - pm.addPass(fir::createOMPFunctionFilteringPass()); + pm.addPass(fir::createOMPFunctionFiltering()); } #if !defined(FLANG_EXCLUDE_CODEGEN) diff --git a/flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp b/flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp index 005e84c..0c47224 100644 --- a/flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp +++ b/flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp @@ -103,7 +103,3 @@ public: } }; } // namespace - -std::unique_ptr<Pass> fir::createOMPFunctionFilteringPass() { - return std::make_unique<OMPFunctionFilteringPass>(); -} |