Skip to content

Commit dfe2ffe

Browse files
committed
AMDGPU: Test handling of R_AMDGPU_ABS64 in RelocVisitor
llvm-svn: 300472
1 parent bf1ded2 commit dfe2ffe

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -verify-machineinstrs -filetype=obj < %s | llvm-dwarfdump - 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 *A) {
8+
; *A = 11;
9+
; }
10+
;
11+
; kernel void kernel2(global int *B) {
12+
; *B = 12;
13+
; }
14+
15+
; CHECK-NOT: failed to compute relocation
16+
; CHECK: file_names[ 1] 0 0x00000000 0x00000000 dwarfdump-relocs.cl
17+
18+
declare void @llvm.dbg.declare(metadata, metadata, metadata)
19+
20+
define amdgpu_kernel void @kernel1(i32 addrspace(1)* %A) !dbg !7 {
21+
entry:
22+
%A.addr = alloca i32 addrspace(1)*, align 4
23+
store i32 addrspace(1)* %A, i32 addrspace(1)** %A.addr, align 4
24+
call void @llvm.dbg.declare(metadata i32 addrspace(1)** %A.addr, metadata !16, metadata !17), !dbg !18
25+
%0 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !19
26+
store i32 11, i32 addrspace(1)* %0, align 4, !dbg !20
27+
ret void, !dbg !21
28+
}
29+
30+
define amdgpu_kernel void @kernel2(i32 addrspace(1)* %B) !dbg !22 {
31+
entry:
32+
%B.addr = alloca i32 addrspace(1)*, align 4
33+
store i32 addrspace(1)* %B, i32 addrspace(1)** %B.addr, align 4
34+
call void @llvm.dbg.declare(metadata i32 addrspace(1)** %B.addr, metadata !23, metadata !17), !dbg !24
35+
%0 = load i32 addrspace(1)*, i32 addrspace(1)** %B.addr, align 4, !dbg !25
36+
store i32 12, i32 addrspace(1)* %0, align 4, !dbg !26
37+
ret void, !dbg !27
38+
}
39+
40+
!llvm.dbg.cu = !{!0}
41+
!opencl.ocl.version = !{!3, !3}
42+
!llvm.module.flags = !{!4, !5}
43+
!llvm.ident = !{!6}
44+
45+
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
46+
!1 = !DIFile(filename: "dwarfdump-relocs.cl", directory: "/some/random/directory")
47+
!2 = !{}
48+
!3 = !{i32 2, i32 0}
49+
!4 = !{i32 2, !"Dwarf Version", i32 2}
50+
!5 = !{i32 2, !"Debug Info Version", i32 3}
51+
!6 = !{!""}
52+
!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, variables: !2)
53+
!8 = !DISubroutineType(types: !9)
54+
!9 = !{null, !10}
55+
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
56+
!11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
57+
!12 = !{i32 1}
58+
!13 = !{!"none"}
59+
!14 = !{!"int*"}
60+
!15 = !{!""}
61+
!16 = !DILocalVariable(name: "A", arg: 1, scope: !7, file: !1, line: 1, type: !10)
62+
!17 = !DIExpression(DW_OP_constu, 1, DW_OP_swap, DW_OP_xderef)
63+
!18 = !DILocation(line: 1, column: 33, scope: !7)
64+
!19 = !DILocation(line: 2, column: 4, scope: !7)
65+
!20 = !DILocation(line: 2, column: 6, scope: !7)
66+
!21 = !DILocation(line: 3, column: 1, scope: !7)
67+
!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, variables: !2)
68+
!23 = !DILocalVariable(name: "B", arg: 1, scope: !22, file: !1, line: 5, type: !10)
69+
!24 = !DILocation(line: 5, column: 33, scope: !22)
70+
!25 = !DILocation(line: 6, column: 4, scope: !22)
71+
!26 = !DILocation(line: 6, column: 6, scope: !22)
72+
!27 = !DILocation(line: 7, column: 1, scope: !22)

0 commit comments

Comments
 (0)