[flang-commits] [flang] [flang][OpenMP] Lowering support for declare variant. (PR #206988)
Abid Qadeer via flang-commits
flang-commits at lists.llvm.org
Fri Jul 3 03:41:59 PDT 2026
================
@@ -0,0 +1,200 @@
+! RUN: %flang_fc1 -emit-fir -fopenmp -fopenmp-version=51 %s -o - | FileCheck %s
+! RUN: %flang_fc1 -emit-hlfir -fopenmp -fopenmp-version=51 %s -o - | FileCheck %s
+
+! Lowering tests for DECLARE VARIANT callee resolution at call sites.
+! The declarative directive is not lowered; variant selection rewrites
+! procedure calls inside matching OpenMP regions.
+
+subroutine test_sequential_vs_parallel
+ call base()
+ !$omp parallel
+ call base()
+ !$omp end parallel
+end subroutine test_sequential_vs_parallel
+
+subroutine base
+ !$omp declare variant (base:vsub) match (construct={parallel})
+contains
+ subroutine vsub
+ end subroutine
+end subroutine base
----------------
abidh wrote:
Thanks for pointing this out. I agree with you that it should not be allowed. I will add checks for it and update the tests accordingly.
https://github.com/llvm/llvm-project/pull/206988
More information about the flang-commits
mailing list