[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
Sun Oct 11 10:02:40 PDT 2026
================
@@ -7558,6 +7628,18 @@ static void genMetadirective(lower::AbstractConverter &converter,
}
}
+ if (!hasLoopAssociatedCandidate &&
+ llvm::any_of(reachableVariantSpecs, [](const auto *spec) {
+ return spec && hasDirectiveAssociation(spec->DirId(),
+ llvm::omp::Association::Block);
+ }))
+ associatedBlockEval = spliceAssociatedEval<parser::BlockConstruct>(
----------------
MattPD wrote:
Confirmed at 0e411b2: The `ignored_comment` example now places TASKYIELD inside TARGET.
A named INLINEALWAYS with a mismatched procedure name still prevents BLOCK association, although Flang diagnoses it as ignored:
```fortran
subroutine selected()
!$omp metadirective when(implementation={vendor(llvm)}: target)
!dir$ inlinealways different
block
!$omp metadirective when(construct={target}: taskyield) otherwise(taskwait)
end block
end subroutine
```
At 0e411b2, `flang -fopenmp -fopenmp-version=52 -S -emit-llvm repro.f90 -o -` reports the name mismatch. Flang emits an empty TARGET. TASKWAIT appears outside it.
Removing the ignored line puts TASKYIELD inside TARGET. The [merge base](https://github.com/llvm/llvm-project/commit/ae7f7ef515657eeb037e1cad045ade1a45cc7951) also misses this association.
Could the scan recognize this ignored case while preserving the directive's effect when its name matches the subprogram?
https://github.com/llvm/llvm-project/pull/224431
More information about the flang-commits
mailing list