xref: /llvm-project/mlir/test/Target/LLVMIR/omptarget-debug2.mlir (revision cdb3ebf1e62df060767863e1e683409d6077ca6e)
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.
5module 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      %13 = llvm.mlir.constant(1 : i32) : i32
12      llvm.store %13, %arg0 : i32, !llvm.ptr loc(#loc2)
13      omp.terminator
14    }
15    llvm.return
16  } loc(#loc3)
17}
18#file = #llvm.di_file<"target.f90" in "">
19#cu = #llvm.di_compile_unit<id = distinct[0]<>,
20 sourceLanguage = DW_LANG_Fortran95, file = #file, isOptimized = false,
21 emissionKind = LineTablesOnly>
22#sp_ty = #llvm.di_subroutine_type<callingConvention = DW_CC_normal>
23#sp = #llvm.di_subprogram<id = distinct[1]<>, compileUnit = #cu, scope = #file,
24 name = "_QQmain", file = #file, subprogramFlags = "Definition", type = #sp_ty>
25#loc1 = loc("target.f90":1:1)
26#loc2 = loc("target.f90":46:3)
27#loc3 = loc(fused<#sp>[#loc1])
28
29// CHECK-DAG: ![[SP:.*]] = {{.*}}!DISubprogram(name: "__omp_offloading_{{.*}}"{{.*}})
30// CHECK-DAG: !DILocation(line: 46, column: 3, scope: ![[SP]])
31