[PATCH] D154180: [OPENMP52] Codegen support for doacross clause.
Alexey Bataev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Jul 3 05:29:04 PDT 2023
ABataev added inline comments.
================
Comment at: clang/lib/CodeGen/CGOpenMPRuntime.cpp:11405-11406
+ llvm::OpenMPIRBuilder &OMPBuilder = CGM.getOpenMPRuntime().getOMPBuilder();
+ const OMPDependClause *DepC = dyn_cast<OMPDependClause>(C);
+ const OMPDoacrossClause *DoC = dyn_cast<OMPDoacrossClause>(C);
+ if ((DoC && DoC->getDependenceType() == OMPC_DOACROSS_source) ||
----------------
1. const auto *
2. Can you try torework it to make it more C++-ish? Use template deduction to avoid runtime dyn_casts.
e.g. something like:
```
namespace {
template <typename T>
class OMPDoacrossKind {
public:
bool isSink(const T *) {return false;}
}
}
template <>
class OMPDoacrossKInd<OMPDependClause> {
public:
bool isSink(const OMPDependClause* C) {return C->getDependenceType();}
}
...
```
and use `if (OMPDoacrossKInd<T>::isSink(C)) RTLFn = ...` and same for `Source`
================
Comment at: clang/lib/CodeGen/CGStmtOpenMP.cpp:5859-5868
+ const auto DOC = dyn_cast<OMPDoacrossClause>(C);
+ const auto DC = dyn_cast<OMPDependClause>(C);
+ bool IsDependSource = false;
+ if ((DC && DC->getDependencyKind() == OMPC_DEPEND_source) ||
+ (DOC && DOC->getDependenceType() == OMPC_DOACROSS_source))
+ IsDependSource = true;
+ CGF.Builder.restoreIP(
----------------
Same, use template-based analysis instead of runtime-based.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D154180/new/
https://reviews.llvm.org/D154180
More information about the cfe-commits
mailing list