[llvm-branch-commits] [flang] [llvm] [mlir] [Flang][OpenMP][MLIR] Initial declare target to for variables implementation (PR #119589)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Nov 24 07:06:07 PST 2025


================
@@ -0,0 +1,36 @@
+! Test the implicit `declare target to` interaction with `target update from`
+! REQUIRES: flang, amdgpu
+
+! RUN: %libomptarget-compile-fortran-run-and-check-generic
+module test
+    implicit none
+    integer :: array(10)
+    !$omp declare target(array)
+end module test
+
+PROGRAM main
+    use test
+    implicit none
+    integer :: i
+
+  !$omp target
+    do i = 1, 10
+        array(i) = i
+    end do
+  !$omp end target
+
+  !$omp target
+    do i = 1, 10
+        array(i) = array(i) + i
+    end do
+  !$omp end target
+
+   print *, array
+
+  !$omp target update from(array)
+
+   print *, array
+END PROGRAM
+
+! CHECK: 0 0 0 0 0 0 0 0 0 0
----------------
agozillon wrote:

nice catch! Thanks Sergio :-)

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


More information about the llvm-branch-commits mailing list