================
@@ -2635,6 +2656,10 @@ std::optional<MetadirectiveCandidateSet> 
BuildMetadirectiveCandidateSet(
       llvm::omp::VariantMatchInfo rawVMI;
       std::optional<DynamicUserCondition> dynamicCondition{
           MakeVariantMatchInfo(rawVMI, *ctxSel, context)};
+      // An omitted directive is ranked without its condition, except for its
+      // unguarded match_any candidate below.
+      if (dynamicCondition && isExplicit)
----------------
MattPD wrote:

Could the subset comparison retain the WHEN condition even when its directive 
is omitted? [The 
baseline](https://github.com/llvm/llvm-project/commit/9f63b3c669b726e020a1f2a63e23c47d8349356c)
 emits unconditional TASKWAIT, but the reviewed head emits TASKYIELD when `b` 
is true. Compile with `flang -fopenmp -fopenmp-version=52 -S -emit-llvm 
repro.f90 -o -`:
```fortran
subroutine three_clause(b)
  logical, intent(in) :: b
  !$omp metadirective when(user={condition(b)}: taskyield) &
  !$omp& when(user={condition(.true.)}, implementation={vendor(llvm)}: 
taskwait) &
  !$omp& when(user={condition(b)}, implementation={vendor(llvm)}:)
end subroutine
```
All raw scores are one. The first selector is a strict subset of the third, so 
OpenMP 5.2 section 7.3 gives it score zero. Section 7.4 then places explicit 
TASKWAIT before implicit NOTHING. Replacing only the omission with `nothing` 
emits unconditional TASKWAIT on both revisions.

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

Reply via email to