[flang-commits] [flang] [flang][OpenMP] Lowering support for declare variant. (PR #206988)

via flang-commits flang-commits at lists.llvm.org
Wed Jul 1 12:52:35 PDT 2026


SunilKuravinakop wrote:

Can you include a test case which at the call site has a parameter e.g.
```
subroutine base(n)
  integer, intent(n) :: n
  !$omp declare variant(base:vsub) match(user={condition(n > 20)})
  contains
  subroutine vsub
  end subroutine
end subroutine

subroutine driver(size)
  use variants
  integer, intent(in) :: size
  call base(size)   ! base/vsub chosen depends on `size` at run time
end subroutine
```
The idea is to determine the call during runtime. In both of your cases the condition is either `.true.` or` .false.` which forces a compilation time determination of the call (/its variant).

https://github.com/llvm/llvm-project/pull/206988


More information about the flang-commits mailing list