|
| 1 | +! RUN: %flang_fc1 -fopenmp -flang-experimental-hlfir -emit-llvm %s -o - | FileCheck --check-prefixes=LLVM-HOST %s |
| 2 | +! RUN: %flang_fc1 -fopenmp -emit-hlfir %s -o - | FileCheck --check-prefixes=MLIR-HOST,MLIR-ALL %s |
| 3 | +! RUN: %flang_fc1 -fopenmp -fopenmp-is-target-device -flang-experimental-hlfir -emit-llvm %s -o - | FileCheck --check-prefixes=LLVM-DEVICE %s |
| 4 | +! RUN: %flang_fc1 -fopenmp -fopenmp-is-target-device -emit-hlfir %s -o - | FileCheck --check-prefixes=MLIR-DEVICE,MLIR-ALL %s |
| 5 | +! RUN: bbc -fopenmp -emit-hlfir %s -o - | FileCheck --check-prefixes=MLIR-HOST,MLIR-ALL %s |
| 6 | +! RUN: bbc -fopenmp -fopenmp-is-target-device -emit-hlfir %s -o - | FileCheck --check-prefixes=MLIR-DEVICE,MLIR-ALL %s |
| 7 | + |
| 8 | +! Check that the correct LLVM IR functions are kept for the host and device |
| 9 | +! after running the whole set of translation and transformation passes from |
| 10 | +! Fortran. |
| 11 | + |
| 12 | +! MLIR-HOST: func.func @{{.*}}host_parent_procedure( |
| 13 | +! MLIR-HOST: return |
| 14 | +! MLIR-DEVICE-NOT: func.func {{.*}}host_parent_procedure( |
| 15 | + |
| 16 | +! LLVM-HOST: define {{.*}} @host_parent_procedure{{.*}}( |
| 17 | +! LLVM-DEVICE-NOT: {{.*}} @{{.*}}_host_parent_procedure{{.*}}( |
| 18 | +subroutine host_parent_procedure(x) |
| 19 | + integer, intent(out) :: x |
| 20 | + call target_internal_proc(x) |
| 21 | +contains |
| 22 | +! MLIR-ALL: func.func private @_QFhost_parent_procedurePtarget_internal_proc( |
| 23 | + |
| 24 | +! LLVM-HOST: define {{.*}} @_QFhost_parent_procedurePtarget_internal_proc( |
| 25 | +! LLVM-HOST: define {{.*}} @__omp_offloading_{{.*}}QFhost_parent_procedurePtarget_internal_proc{{.*}}( |
| 26 | + |
| 27 | +! FIXME: the last check above should also work on the host, but the offload function |
| 28 | +! is deleted because it is private and all its usages have been removed in the |
| 29 | +! device code. Maybe the private attribute should be removed on internal |
| 30 | +! functions while filtering? |
| 31 | +subroutine target_internal_proc(x) |
| 32 | + integer, intent(out) :: x |
| 33 | + !$omp target map(from:x) |
| 34 | + x = 10 |
| 35 | + !$omp end target |
| 36 | +end subroutine |
| 37 | +end subroutine |
0 commit comments