[flang-commits] [flang] [flang][OpenMP][NFC] Reduce OMPMarkDeclareTarget boilerplate (PR #93797)

via flang-commits flang-commits at lists.llvm.org
Thu May 30 03:06:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-openmp

Author: Tom Eccles (tblah)

<details>
<summary>Changes</summary>

The pass constructor can be generated automatically by tablegen.

This pass does not need adapting to work with non-function top level operations because it operates specifically on call operations inside of an OpenMP declare target function.

---
Full diff: https://github.com/llvm/llvm-project/pull/93797.diff


3 Files Affected:

- (modified) flang/include/flang/Optimizer/Transforms/Passes.h (+1-2) 
- (modified) flang/include/flang/Optimizer/Transforms/Passes.td (-1) 
- (modified) flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp (-7) 


``````````diff
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.h b/flang/include/flang/Optimizer/Transforms/Passes.h
index 151719ea71ef0..46c38d107eec3 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.h
+++ b/flang/include/flang/Optimizer/Transforms/Passes.h
@@ -52,6 +52,7 @@ namespace fir {
 #define GEN_PASS_DECL_LOOPVERSIONING
 #define GEN_PASS_DECL_ADDALIASTAGS
 #define GEN_PASS_DECL_OMPMAPINFOFINALIZATIONPASS
+#define GEN_PASS_DECL_OMPMARKDECLARETARGETPASS
 #include "flang/Optimizer/Transforms/Passes.h.inc"
 
 std::unique_ptr<mlir::Pass> createAffineDemotionPass();
@@ -72,8 +73,6 @@ std::unique_ptr<mlir::Pass>
 createAlgebraicSimplificationPass(const mlir::GreedyRewriteConfig &config);
 
 std::unique_ptr<mlir::Pass> createOMPFunctionFilteringPass();
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-createOMPMarkDeclareTargetPass();
 
 std::unique_ptr<mlir::Pass> createVScaleAttrPass();
 std::unique_ptr<mlir::Pass>
diff --git a/flang/include/flang/Optimizer/Transforms/Passes.td b/flang/include/flang/Optimizer/Transforms/Passes.td
index b0f1ad61251ce..f03412807d40a 100644
--- a/flang/include/flang/Optimizer/Transforms/Passes.td
+++ b/flang/include/flang/Optimizer/Transforms/Passes.td
@@ -337,7 +337,6 @@ def OMPMapInfoFinalizationPass
 def OMPMarkDeclareTargetPass
     : Pass<"omp-mark-declare-target", "mlir::ModuleOp"> {
   let summary = "Marks all functions called by an OpenMP declare target function as declare target";
-  let constructor = "::fir::createOMPMarkDeclareTargetPass()";
   let dependentDialects = ["mlir::omp::OpenMPDialect"];
 }
 
diff --git a/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp b/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
index bebcb2a4f5687..4946e13b22865 100644
--- a/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
+++ b/flang/lib/Optimizer/Transforms/OMPMarkDeclareTarget.cpp
@@ -88,10 +88,3 @@ class OMPMarkDeclareTargetPass
 };
 
 } // namespace
-
-namespace fir {
-std::unique_ptr<mlir::OperationPass<mlir::ModuleOp>>
-createOMPMarkDeclareTargetPass() {
-  return std::make_unique<OMPMarkDeclareTargetPass>();
-}
-} // namespace fir

``````````

</details>


https://github.com/llvm/llvm-project/pull/93797


More information about the flang-commits mailing list