================
@@ -2621,8 +2624,10 @@ std::optional<MetadirectiveCandidateSet> 
BuildMetadirectiveCandidateSet(
           staticVMI.ScoreMap.erase(scoreIt);
         }
         staticVMI.RequiredTraits.reset(unsigned(dynamicConditionTrait));
+        staticVMI.UserCondition = {};
----------------
MattPD wrote:

Clearing the identity lets the unguarded alternative compare as a subset of a 
WHEN clause with a different condition. Compile this with `flang -fopenmp 
-fopenmp-version=52 -S -emit-llvm repro.f90 -o -`:

```fortran
subroutine s(a, b)
  logical :: a, b
  !$omp metadirective &
  !$omp& when(implementation={vendor(score(50): llvm), extension(match_any)}, &
  !$omp& user={condition(a)}: taskyield) &
  !$omp& when(implementation={vendor(llvm), extension(match_any)}, &
  !$omp& device={kind(cpu)}, user={condition(b)}: taskwait)
end subroutine
```

At 82f18330, the result is TASKYIELD when `a` is true and TASKWAIT otherwise. 
The 
[parent](https://github.com/llvm/llvm-project/commit/6544686b4a86193fc0bf6d229d59df20a4251e7f)
 emits unconditional TASKYIELD. The first WHEN is always applicable through 
`vendor(llvm)` and scores 51 against 2. Its distinct `condition(a)` prevents a 
subset relationship with the second WHEN. Could the unguarded alternative 
preserve the original WHEN's condition identity for subset checks?

https://github.com/llvm/llvm-project/pull/231668
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to