[flang-commits] [flang] [flang][OpenMP] Implement getOpenMPVersion helper function, NFC (PR #90086)
via flang-commits
flang-commits at lists.llvm.org
Thu Apr 25 09:57:47 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-flang-fir-hlfir
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/90086.diff
2 Files Affected:
- (modified) flang/lib/Lower/OpenMP/Utils.cpp (+6)
- (modified) flang/lib/Lower/OpenMP/Utils.h (+1)
``````````diff
diff --git a/flang/lib/Lower/OpenMP/Utils.cpp b/flang/lib/Lower/OpenMP/Utils.cpp
index da3f2be73e5095..1400f1f4cc8dd2 100644
--- a/flang/lib/Lower/OpenMP/Utils.cpp
+++ b/flang/lib/Lower/OpenMP/Utils.cpp
@@ -47,6 +47,12 @@ int64_t getCollapseValue(const List<Clause> &clauses) {
return 1;
}
+uint32_t getOpenMPVersion(mlir::ModuleOp mod) {
+ if (mlir::Attribute verAttr = mod->getAttr("omp.version"))
+ return llvm::cast<mlir::omp::VersionAttr>(verAttr).getVersion();
+ llvm_unreachable("Expecting OpenMP version attribute in module");
+}
+
void genObjectList(const ObjectList &objects,
Fortran::lower::AbstractConverter &converter,
llvm::SmallVectorImpl<mlir::Value> &operands) {
diff --git a/flang/lib/Lower/OpenMP/Utils.h b/flang/lib/Lower/OpenMP/Utils.h
index b3a9f7f30c98bd..693a91f7cc6954 100644
--- a/flang/lib/Lower/OpenMP/Utils.h
+++ b/flang/lib/Lower/OpenMP/Utils.h
@@ -59,6 +59,7 @@ void gatherFuncAndVarSyms(
llvm::SmallVectorImpl<DeclareTargetCapturePair> &symbolAndClause);
int64_t getCollapseValue(const List<Clause> &clauses);
+uint32_t getOpenMPVersion(mlir::ModuleOp mod);
Fortran::semantics::Symbol *
getOmpObjectSymbol(const Fortran::parser::OmpObject &ompObject);
``````````
</details>
https://github.com/llvm/llvm-project/pull/90086
More information about the flang-commits
mailing list