Skip to content

Commit a780f18

Browse files
committed
Add testcase with is_target_device = false
1 parent 84318a9 commit a780f18

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
2+
3+
// Same test as omptarget-debug.mlir but with is_target_device = false.
4+
// Somehow test with omp.target don't work with -split-input-file.
5+
module attributes {omp.is_target_device = false} {
6+
llvm.func @_QQmain() {
7+
%0 = llvm.mlir.constant(1 : i32) : i32
8+
%1 = llvm.alloca %0 x i32 : (i32) -> !llvm.ptr
9+
%9 = omp.map.info var_ptr(%1 : !llvm.ptr, i32) map_clauses(tofrom) capture(ByRef) -> !llvm.ptr {name = ""}
10+
omp.target map_entries(%9 -> %arg0 : !llvm.ptr) {
11+
^bb0(%arg0: !llvm.ptr):
12+
%13 = llvm.mlir.constant(1 : i32) : i32
13+
llvm.store %13, %arg0 : i32, !llvm.ptr loc(#loc2)
14+
omp.terminator
15+
}
16+
llvm.return
17+
} loc(#loc3)
18+
}
19+
#file = #llvm.di_file<"target.f90" in "">
20+
#cu = #llvm.di_compile_unit<id = distinct[0]<>,
21+
sourceLanguage = DW_LANG_Fortran95, file = #file, isOptimized = false,
22+
emissionKind = LineTablesOnly>
23+
#sp_ty = #llvm.di_subroutine_type<callingConvention = DW_CC_normal>
24+
#sp = #llvm.di_subprogram<id = distinct[1]<>, compileUnit = #cu, scope = #file,
25+
name = "_QQmain", file = #file, subprogramFlags = "Definition", type = #sp_ty>
26+
#loc1 = loc("target.f90":1:1)
27+
#loc2 = loc("target.f90":46:3)
28+
#loc3 = loc(fused<#sp>[#loc1])
29+
30+
// CHECK-DAG: ![[SP:.*]] = {{.*}}!DISubprogram(name: "__omp_offloading_{{.*}}"{{.*}})
31+
// CHECK-DAG: !DILocation(line: 46, column: 3, scope: ![[SP]])

0 commit comments

Comments
 (0)