[llvm-branch-commits] [clang] [clang][OpenMP] Simplify check for taskloop in `ActOnOpenMPLoopInitia… (PR #98633)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Jul 12 06:38:07 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: Krzysztof Parzyszek (kparzysz)
<details>
<summary>Changes</summary>
…lization`
Replace the explicit list of compound directives ending with taskloop with checking for the last leaf construct.
---
Full diff: https://github.com/llvm/llvm-project/pull/98633.diff
1 Files Affected:
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+5-4)
``````````diff
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 2340873c8fdd9..118cda253a437 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -9090,14 +9090,15 @@ void SemaOpenMP::ActOnOpenMPLoopInitialization(SourceLocation ForLoc,
isOpenMPSimdDirective(DKind)
? (DSAStack->hasMutipleLoops() ? OMPC_lastprivate : OMPC_linear)
: OMPC_private;
+ auto isOpenMPTaskloopDirective = [](OpenMPDirectiveKind DK) {
+ return getLeafConstructsOrSelf(DK).back() == OMPD_taskloop;
+ };
if (((isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
DVar.CKind != PredeterminedCKind && DVar.RefExpr &&
(getLangOpts().OpenMP <= 45 ||
(DVar.CKind != OMPC_lastprivate && DVar.CKind != OMPC_private))) ||
- ((isOpenMPWorksharingDirective(DKind) || DKind == OMPD_taskloop ||
- DKind == OMPD_master_taskloop || DKind == OMPD_masked_taskloop ||
- DKind == OMPD_parallel_master_taskloop ||
- DKind == OMPD_parallel_masked_taskloop ||
+ ((isOpenMPWorksharingDirective(DKind) ||
+ isOpenMPTaskloopDirective(DKind) ||
isOpenMPDistributeDirective(DKind)) &&
!isOpenMPSimdDirective(DKind) && DVar.CKind != OMPC_unknown &&
DVar.CKind != OMPC_private && DVar.CKind != OMPC_lastprivate)) &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/98633
More information about the llvm-branch-commits
mailing list