Skip to content

Commit 6a21730

Browse files
authored
[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.
1 parent 8918d35 commit 6a21730

File tree

4 files changed

+2
-8
lines changed

4 files changed

+2
-8
lines changed

flang/include/flang/Optimizer/Transforms/Passes.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ namespace fir {
5353
#define GEN_PASS_DECL_ADDALIASTAGS
5454
#define GEN_PASS_DECL_OMPMAPINFOFINALIZATIONPASS
5555
#define GEN_PASS_DECL_OMPMARKDECLARETARGETPASS
56+
#define GEN_PASS_DECL_OMPFUNCTIONFILTERING
5657
#include "flang/Optimizer/Transforms/Passes.h.inc"
5758

5859
std::unique_ptr<mlir::Pass> createAffineDemotionPass();
@@ -72,8 +73,6 @@ std::unique_ptr<mlir::Pass> createAlgebraicSimplificationPass();
7273
std::unique_ptr<mlir::Pass>
7374
createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
7475

75-
std::unique_ptr<mlir::Pass> createOMPFunctionFilteringPass();
76-
7776
std::unique_ptr<mlir::Pass> createVScaleAttrPass();
7877
std::unique_ptr<mlir::Pass>
7978
createVScaleAttrPass(std::pair<unsigned, unsigned> vscaleAttr);

flang/include/flang/Optimizer/Transforms/Passes.td

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,6 @@ def OMPMarkDeclareTargetPass
343343
def OMPFunctionFiltering : Pass<"omp-function-filtering"> {
344344
let summary = "Filters out functions intended for the host when compiling "
345345
"for the target device.";
346-
let constructor = "::fir::createOMPFunctionFilteringPass()";
347346
let dependentDialects = [
348347
"mlir::func::FuncDialect",
349348
"fir::FIROpsDialect"

flang/include/flang/Tools/CLOptions.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ inline void createOpenMPFIRPassPipeline(
349349
pm, fir::createOMPMapInfoFinalizationPass);
350350
pm.addPass(fir::createOMPMarkDeclareTargetPass());
351351
if (isTargetDevice)
352-
pm.addPass(fir::createOMPFunctionFilteringPass());
352+
pm.addPass(fir::createOMPFunctionFiltering());
353353
}
354354

355355
#if !defined(FLANG_EXCLUDE_CODEGEN)

flang/lib/Optimizer/Transforms/OMPFunctionFiltering.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,3 @@ class OMPFunctionFilteringPass
103103
}
104104
};
105105
} // namespace
106-
107-
std::unique_ptr<Pass> fir::createOMPFunctionFilteringPass() {
108-
return std::make_unique<OMPFunctionFilteringPass>();
109-
}

0 commit comments

Comments
 (0)