Recommit r310809 with a fix for the spill problem
[llvm-core.git] / test / CodeGen / AMDGPU / debugger-insert-nops.ll
blobfcdbfb10a8ca4a57061fcfe0fc20efbdb366dc8a
1 ; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -mattr=+amdgpu-debugger-insert-nops -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECK
2 ; RUN: llc -O0 -mtriple=amdgcn--amdhsa -mcpu=fiji -mattr=+amdgpu-debugger-insert-nops -verify-machineinstrs < %s | FileCheck %s --check-prefix=CHECKNOP
4 ; This test expects that we have one instance for each line in some order with "s_nop 0" instances after each.
6 ; Check that each line appears at least once
7 ; CHECK-DAG: test01.cl:2:3
8 ; CHECK-DAG: test01.cl:3:3
9 ; CHECK-DAG: test01.cl:4:3
12 ; Check that each of each of the lines consists of the line output, followed by "s_nop 0"
13 ; CHECKNOP: test01.cl:{{[234]}}:3
14 ; CHECKNOP-NEXT: s_nop 0
15 ; CHECKNOP: test01.cl:{{[234]}}:3
16 ; CHECKNOP-NEXT: s_nop 0
17 ; CHECKNOP: test01.cl:{{[234]}}:3
18 ; CHECKNOP-NEXT: s_nop 0
20 ; CHECK: test01.cl:5:{{[0-9]+}}
21 ; CHECK-NEXT: s_nop 0
22 ; CHECK-NEXT: s_endpgm
24 ; Function Attrs: nounwind
25 define amdgpu_kernel void @test(i32 addrspace(1)* %A) #0 !dbg !12 {
26 entry:
27   %A.addr = alloca i32 addrspace(1)*, align 4
28   store i32 addrspace(1)* %A, i32 addrspace(1)** %A.addr, align 4
29   call void @llvm.dbg.declare(metadata i32 addrspace(1)** %A.addr, metadata !17, metadata !18), !dbg !19
30   %0 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !20
31   %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %0, i32 0, !dbg !20
32   store i32 1, i32 addrspace(1)* %arrayidx, align 4, !dbg !20
33   %1 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !22
34   %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %1, i32 1, !dbg !22
35   store i32 2, i32 addrspace(1)* %arrayidx1, align 4, !dbg !23
36   %2 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4, !dbg !24
37   %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %2, i32 2, !dbg !24
38   store i32 3, i32 addrspace(1)* %arrayidx2, align 4, !dbg !25
39   ret void, !dbg !26
42 ; Function Attrs: nounwind readnone
43 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
45 attributes #0 = { nounwind }
46 attributes #1 = { nounwind readnone }
48 !llvm.dbg.cu = !{!0}
49 !opencl.kernels = !{!3}
50 !llvm.module.flags = !{!9, !10}
51 !llvm.ident = !{!11}
53 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 268929)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
54 !1 = !DIFile(filename: "test01.cl", directory: "/home/kzhuravl/Lightning/testing")
55 !2 = !{}
56 !3 = !{void (i32 addrspace(1)*)* @test, !4, !5, !6, !7, !8}
57 !4 = !{!"kernel_arg_addr_space", i32 1}
58 !5 = !{!"kernel_arg_access_qual", !"none"}
59 !6 = !{!"kernel_arg_type", !"int*"}
60 !7 = !{!"kernel_arg_base_type", !"int*"}
61 !8 = !{!"kernel_arg_type_qual", !""}
62 !9 = !{i32 2, !"Dwarf Version", i32 2}
63 !10 = !{i32 2, !"Debug Info Version", i32 3}
64 !11 = !{!"clang version 3.9.0 (trunk 268929)"}
65 !12 = distinct !DISubprogram(name: "test", scope: !1, file: !1, line: 1, type: !13, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
66 !13 = !DISubroutineType(types: !14)
67 !14 = !{null, !15}
68 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 32)
69 !16 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
70 !17 = !DILocalVariable(name: "A", arg: 1, scope: !12, file: !1, line: 1, type: !15)
71 !18 = !DIExpression()
72 !19 = !DILocation(line: 1, column: 30, scope: !12)
73 !20 = !DILocation(line: 2, column: 3, scope: !12)
74 !21 = !DILocation(line: 2, column: 8, scope: !12)
75 !22 = !DILocation(line: 3, column: 3, scope: !12)
76 !23 = !DILocation(line: 3, column: 8, scope: !12)
77 !24 = !DILocation(line: 4, column: 3, scope: !12)
78 !25 = !DILocation(line: 4, column: 8, scope: !12)
79 !26 = !DILocation(line: 5, column: 1, scope: !12)