[flang-commits] [flang] [mlir] [MLIR][OpenMP] Changes to function-filtering pass (PR #71850)
Sergio Afonso via flang-commits
flang-commits at lists.llvm.org
Fri Nov 10 03:27:02 PST 2023
================
@@ -0,0 +1,37 @@
+!RUN: %flang_fc1 -emit-llvm -fopenmp %s -o - | FileCheck %s --check-prefixes HOST
+!RUN: %flang_fc1 -emit-llvm -fopenmp -fopenmp-is-target-device %s -o - | FileCheck %s --check-prefixes DEVICE
+
+!HOST: define {{.*}}@{{.*}}before{{.*}}(
+!DEVICE-NOT: define {{.*}}@before{{.*}}(
+!DEVICE-NOT: declare {{.*}}@before{{.*}}
+integer function before(x)
+integer, intent(in) :: x
+before = x + 200
+end function
+
+!HOST: define {{.*}}@{{.*}}main{{.*}}(
+!DEVICE: define {{.*}}@{{.*}}main{{.*}}(
+program main
+integer :: x, before, after
+!$omp target map(tofrom : x)
+ x = 100
+!$omp end target
+!HOST: call {{.*}}@{{.*}}before{{.*}}(
+!DEVICE-NOT: call {{.*}}@before{{.*}}(
+!HOST: call {{.*}}@{{.*}}after{{.*}}(
+!DEVICE-NOT: call {{.*}}@after{{.*}}(
+x = x + before(x) + after(x)
+WRITE(*,*) "Test:", x
+!$omp target map(tofrom : x)
+ x = 50
+!$omp end target
+WRITE(*,*) "Test:", x
+end program
+
+!HOST: define {{.*}}@{{.*}}after{{.*}}(
+!DEVICE-NOT: define {{.*}}@after{{.*}}(
+!DEVICE-NOT: declare {{.*}}@after{{.*}}
+integer function after(x)
+integer, intent(in) :: x
+after = x + 300
+end function
----------------
skatrak wrote:
Nit: Add new line at the end of the file.
https://github.com/llvm/llvm-project/pull/71850
More information about the flang-commits
mailing list