llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Krzysztof Parzyszek (kparzysz) <details> <summary>Changes</summary> Follow-up to 81cdf9472c (check for `scan` nesting). Also, it eliminates the mentions of combined directives in `ActOnOpenMPReductionClause`. --- Full diff: https://github.com/llvm/llvm-project/pull/98500.diff 1 Files Affected: - (modified) clang/lib/Sema/SemaOpenMP.cpp (+16-8) ``````````diff diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 7ca89b0d4eb70..dc77a51b6569e 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -18603,14 +18603,22 @@ OMPClause *SemaOpenMP::ActOnOpenMPReductionClause( // worksharing-loop construct, a worksharing-loop SIMD construct, a simd // construct, a parallel worksharing-loop construct or a parallel // worksharing-loop SIMD construct. - if (Modifier == OMPC_REDUCTION_inscan && - (DSAStack->getCurrentDirective() != OMPD_for && - DSAStack->getCurrentDirective() != OMPD_for_simd && - DSAStack->getCurrentDirective() != OMPD_simd && - DSAStack->getCurrentDirective() != OMPD_parallel_for && - DSAStack->getCurrentDirective() != OMPD_parallel_for_simd)) { - Diag(ModifierLoc, diag::err_omp_wrong_inscan_reduction); - return nullptr; + // [5.2:136:1-4] A reduction clause with the inscan reduction-modifier may + // only appear on a worksharing-loop construct, a simd construct or a + // combined or composite construct for which any of the aforementioned + // constructs is a constituent construct and distribute is not a constituent + // construct. + if (Modifier == OMPC_REDUCTION_inscan) { + SmallVector<OpenMPDirectiveKind, 4> LeafOrComposite; + ArrayRef<OpenMPDirectiveKind> CurrentLOC = getLeafOrCompositeConstructs( + DSAStack->getCurrentDirective(), LeafOrComposite); + bool Valid = llvm::any_of(CurrentLOC, [](OpenMPDirectiveKind DK) { + return llvm::is_contained({OMPD_for, OMPD_simd, OMPD_for_simd}, DK); + }); + if (!Valid) { + Diag(ModifierLoc, diag::err_omp_wrong_inscan_reduction); + return nullptr; + } } ReductionData RD(VarList.size(), Modifier); `````````` </details> https://github.com/llvm/llvm-project/pull/98500 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits