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

Abid Qadeer via flang-commits flang-commits at lists.llvm.org
Thu Jul 2 02:43:15 PDT 2026


abidh wrote:

> 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

There is already a test `base7` in `declare-variant-call.f90` that tests call site with an argument. Please also note that declare variant does not support dynamic condition at the moment. Something like above will generate following error:
`error: Run-time USER condition in the MATCH clause is not yet implemented`

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


More information about the flang-commits mailing list