[flang-commits] [clang] [flang] [llvm] [flang][clang][OpenMP] Fix context selector matching and scoring (PR #231668)
via flang-commits
flang-commits at lists.llvm.org
Tue Oct 13 18:51:22 PDT 2026
================
@@ -2500,18 +2500,21 @@ static void AddTraitPropertiesFromSelector(llvm::omp::TraitSet set,
if (!scalarExpr) {
continue;
}
+ // Subset checks compare condition identities; distinct conditions must
+ // not share one.
+ llvm::StringRef identity{prop.source.begin(), prop.source.size()};
----------------
MattPD wrote:
Using source text as the identity makes insignificant blanks change selection. With `flang -fopenmp -fopenmp-version=52 -S -emit-llvm repro.f90 -o -`, this selects TASKYIELD at 82f18330 instead of TASKWAIT at the [parent](https://github.com/llvm/llvm-project/commit/6544686b4a86193fc0bf6d229d59df20a4251e7f):
```fortran
subroutine s()
!$omp metadirective &
!$omp& when(user={condition(1==1)}: taskyield) &
!$omp& when(user={condition(1 == 1)}, implementation={vendor(llvm)}: taskwait)
end subroutine
```
Both conditions are the same expression, so the first selector is a strict subset of the second. Giving both conditions the same spelling restores TASKWAIT at 82f18330. Could the identity come from the parsed expression rather than its spelling, with a frontend regression test?
https://github.com/llvm/llvm-project/pull/231668
More information about the flang-commits
mailing list