[flang-commits] [clang] [flang] [llvm] [clang][flang][OpenMP] Fix context selector matching and scoring (PR #224431)
via flang-commits
flang-commits at lists.llvm.org
Fri Sep 25 15:07:47 PDT 2026
================
@@ -5389,6 +5406,14 @@ static mlir::omp::DistributeOp genCompositeDistributeParallelDoSimd(
ConstructQueue::const_iterator doItem = std::next(parallelItem);
ConstructQueue::const_iterator simdItem = std::next(doItem);
+ // Evaluate DISTRIBUTE clauses before entering its source context and then
+ // PARALLEL, as in the explicit nesting.
+ mlir::omp::DistributeOperands distributeClauseOps;
+ genDistributeClauses(converter, semaCtx, stmtCtx, distributeItem->clauses,
+ loc, distributeClauseOps);
+ mlir::SaveStateStack<OpenMPContextFrame> distributeContext{
----------------
MattPD wrote:
Confirmed at 1aa333a: The fix works for `do simd`, `parallel do simd`, and `teams distribute parallel do simd`.
`genCompositeDistributeSimd` still lowers the SIMD clauses of `distribute simd` without a DISTRIBUTE frame. When `pred` has a `kind(cpu)` variant and a `vendor(score(3))` variant, `teams distribute simd if(simd: pred(n))` selects the vendor variant, while the explicit nest of the three constructs selects the CPU variant. At the merge base, both forms select the vendor variant. Should `genCompositeDistributeSimd` also enter DISTRIBUTE around its SIMD clauses?
https://github.com/llvm/llvm-project/pull/224431
More information about the flang-commits
mailing list