• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs -filetype=obj < %s | llvm-dwarfdump -v - 2>&1 | FileCheck %s
2
3; LLVM IR generated with the following command and OpenCL source:
4;
5; $clang -cl-std=CL2.0 -g -O0 -target amdgcn-amd-amdhsa -S -emit-llvm <path-to-file>
6;
7; kernel void kernel1(global int  addrspace(5)*A) {
8;   *A = 11;
9; }
10;
11; kernel void kernel2(global int  addrspace(5)*B) {
12;   *B = 12;
13; }
14
15; CHECK-NOT: failed to compute relocation
16; CHECK: file_names[  1]:
17; CHECK-NEXT: name: "dwarfdump-relocs.cl"
18; CHECK-NEXT: dir_index: 0
19
20declare void @llvm.dbg.declare(metadata, metadata, metadata)
21
22define amdgpu_kernel void @kernel1(i32 addrspace(1)* %A) !dbg !7 {
23entry:
24  %A.addr = alloca i32 addrspace(1)*, align 4, addrspace(5)
25  store i32 addrspace(1)* %A, i32 addrspace(1)* addrspace(5)* %A.addr, align 4
26  call void @llvm.dbg.declare(metadata i32 addrspace(1)* addrspace(5)* %A.addr, metadata !16, metadata !17), !dbg !18
27  %0 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %A.addr, align 4, !dbg !19
28  store i32 11, i32 addrspace(1)* %0, align 4, !dbg !20
29  ret void, !dbg !21
30}
31
32define amdgpu_kernel void @kernel2(i32 addrspace(1)* %B) !dbg !22 {
33entry:
34  %B.addr = alloca i32 addrspace(1)*, align 4, addrspace(5)
35  store i32 addrspace(1)* %B, i32 addrspace(1)* addrspace(5)* %B.addr, align 4
36  call void @llvm.dbg.declare(metadata i32 addrspace(1)* addrspace(5)* %B.addr, metadata !23, metadata !17), !dbg !24
37  %0 = load i32 addrspace(1)*, i32 addrspace(1)* addrspace(5)* %B.addr, align 4, !dbg !25
38  store i32 12, i32 addrspace(1)* %0, align 4, !dbg !26
39  ret void, !dbg !27
40}
41
42!llvm.dbg.cu = !{!0}
43!opencl.ocl.version = !{!3, !3}
44!llvm.module.flags = !{!4, !5}
45!llvm.ident = !{!6}
46
47!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
48!1 = !DIFile(filename: "dwarfdump-relocs.cl", directory: "/some/random/directory")
49!2 = !{}
50!3 = !{i32 2, i32 0}
51!4 = !{i32 2, !"Dwarf Version", i32 2}
52!5 = !{i32 2, !"Debug Info Version", i32 3}
53!6 = !{!""}
54!7 = distinct !DISubprogram(name: "kernel1", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
55!8 = !DISubroutineType(types: !9)
56!9 = !{null, !10}
57!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
58!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
59!12 = !{i32 1}
60!13 = !{!"none"}
61!14 = !{!"int addrspace(5)*"}
62!15 = !{!""}
63!16 = !DILocalVariable(name: "A", arg: 1, scope: !7, file: !1, line: 1, type: !10)
64!17 = !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)
65!18 = !DILocation(line: 1, column: 33, scope: !7)
66!19 = !DILocation(line: 2, column: 4, scope: !7)
67!20 = !DILocation(line: 2, column: 6, scope: !7)
68!21 = !DILocation(line: 3, column: 1, scope: !7)
69!22 = distinct !DISubprogram(name: "kernel2", scope: !1, file: !1, line: 5, type: !8, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
70!23 = !DILocalVariable(name: "B", arg: 1, scope: !22, file: !1, line: 5, type: !10)
71!24 = !DILocation(line: 5, column: 33, scope: !22)
72!25 = !DILocation(line: 6, column: 4, scope: !22)
73!26 = !DILocation(line: 6, column: 6, scope: !22)
74!27 = !DILocation(line: 7, column: 1, scope: !22)
75