[all-commits] [llvm/llvm-project] 0c9f16: Fix match_any dynamic user condition ranking

Chi-Chun, Chen via All-commits all-commits at lists.llvm.org
Wed Jun 3 13:24:06 PDT 2026


  Branch: refs/heads/users/cchen/flang-metadirective-dynamic-user-cond
  Home:   https://github.com/llvm/llvm-project
  Commit: 0c9f16cbfd9a71662bd2eefa50e817bc39dbcc21
      https://github.com/llvm/llvm-project/commit/0c9f16cbfd9a71662bd2eefa50e817bc39dbcc21
  Author: Chi Chun, Chen <chichun.chen at hpe.com>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M flang/lib/Lower/OpenMP/OpenMP.cpp
    M flang/test/Lower/OpenMP/metadirective-user.f90

  Log Message:
  -----------
  Fix match_any dynamic user condition ranking

A dynamic condition in extension(match_any) can be false even when another static
trait already makes the variant applicable. Before this change, lowering still
ranked the condition as true in that situation, so `condition(score(N): flag)`
could make the variant win even when flag is false.

The previous change separated static applicability from guarded ranking for
dynamic conditions. This fix adds the match_any-specific handling:

```
  if staticVMI does not match:
    try conditionTrueVMI, because the runtime condition itself may satisfy match_any

  if staticVMI already matches and this is match_any:
    add guarded candidate: flag true, with user_condition_true and score
    add unguarded candidate: flag false, with only static traits

  otherwise:
    use the normal guarded dynamic-condition candidate
```

This way, match_any + vendor(llvm) + condition(score(100): flag) uses the
score only when flag is true. When flag is false, ranking uses only the static
traits.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list