• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -start-before=branch-relaxation -amdgpu-s-branch-bits=4 -o - %s | FileCheck -check-prefix=GCN %s
2
3# Make sure there's no assert if the DBG_VALUE ends up in the same
4# block as the branch expansion.
5
6# GCN-LABEL: long_branch_dbg_value:
7# GCN:  BB0_5: ; %bb
8# GCN-NEXT:    ;DEBUG_VALUE: test_debug_value:globalptr_arg <- [DW_OP_plus_uconst 12, DW_OP_stack_value]
9# GCN-NEXT:    .loc 1 0 42 is_stmt 0 ; /tmp/test_debug_value.cl:0:42
10# GCN-NEXT:    s_getpc_b64 s{{\[}}[[PC_LO:[0-9]+]]:[[PC_HI:[0-9]+]]{{\]}}
11# GCN-NEXT:    s_add_u32 s[[PC_LO]], s[[PC_LO]], BB0_4-(BB0_5+4)
12# GCN-NEXT:    s_addc_u32 s[[PC_HI]], s[[PC_HI]], 0
13# GCN-NEXT:    s_setpc_b64
14
15--- |
16
17  define amdgpu_kernel void @long_branch_dbg_value(float addrspace(1)* nocapture %arg, float %arg1) #1 !dbg !5 {
18  bb:
19    %long_branch_dbg_value.kernarg.segment = call nonnull align 16 dereferenceable(12) i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr()
20    %arg.kernarg.offset = getelementptr inbounds i8, i8 addrspace(4)* %long_branch_dbg_value.kernarg.segment, i64 0
21    %arg.kernarg.offset.cast = bitcast i8 addrspace(4)* %arg.kernarg.offset to float addrspace(1)* addrspace(4)*, !amdgpu.uniform !2, !amdgpu.noclobber !2
22    %arg.load = load float addrspace(1)*, float addrspace(1)* addrspace(4)* %arg.kernarg.offset.cast, align 16, !invariant.load !2
23    %arg1.kernarg.offset = getelementptr inbounds i8, i8 addrspace(4)* %long_branch_dbg_value.kernarg.segment, i64 8
24    %arg1.kernarg.offset.cast = bitcast i8 addrspace(4)* %arg1.kernarg.offset to float addrspace(4)*, !amdgpu.uniform !2, !amdgpu.noclobber !2
25    %arg1.load = load float, float addrspace(4)* %arg1.kernarg.offset.cast, align 8, !invariant.load !2
26    %tmp = fmul float %arg1.load, %arg1.load
27    %tmp2 = getelementptr inbounds float, float addrspace(1)* %arg.load, i64 3
28    call void @llvm.dbg.value(metadata float addrspace(1)* %tmp2, metadata !11, metadata !DIExpression()) #5, !dbg !12
29    store float %tmp, float addrspace(1)* %tmp2, align 4, !dbg !12
30    %tmp3 = fcmp olt float %tmp, 0x3810000000000000
31    %tmp3.inv = xor i1 %tmp3, true
32    br i1 %tmp3.inv, label %bb4, label %bb8, !amdgpu.uniform !2
33
34  bb4:                                              ; preds = %bb
35    %tmp5 = load volatile float, float addrspace(1)* undef, align 4
36    %tmp6 = fcmp oeq float %tmp5, 0x7FF0000000000000
37    br i1 %tmp6, label %bb7, label %Flow, !amdgpu.uniform !2
38
39  bb7:                                              ; preds = %bb4
40    br label %Flow, !amdgpu.uniform !2
41
42  Flow:                                             ; preds = %bb7, %bb4
43    br label %bb8, !amdgpu.uniform !2
44
45  bb8:                                              ; preds = %bb, %Flow
46    ret void
47  }
48
49  declare align 4 i8 addrspace(4)* @llvm.amdgcn.kernarg.segment.ptr() #2
50  declare void @llvm.dbg.value(metadata, metadata, metadata) #0
51
52  attributes #0 = { nounwind readnone speculatable willreturn }
53  attributes #1 = { nounwind writeonly }
54  attributes #2 = { nounwind readnone speculatable willreturn }
55  attributes #3 = { convergent nounwind willreturn }
56  attributes #4 = { convergent nounwind readnone willreturn }
57  attributes #5 = { nounwind }
58
59  !llvm.dbg.cu = !{!0}
60  !llvm.module.flags = !{!3, !4}
61
62  !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.8.0 (trunk 244715) (llvm/trunk 244718)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
63  !1 = !DIFile(filename: "/tmp/test_debug_value.cl", directory: "/Users/matt/src/llvm/build_debug")
64  !2 = !{}
65  !3 = !{i32 2, !"Dwarf Version", i32 4}
66  !4 = !{i32 2, !"Debug Info Version", i32 3}
67  !5 = distinct !DISubprogram(name: "test_debug_value", scope: !1, file: !1, line: 1, type: !6, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10)
68  !6 = !DISubroutineType(types: !7)
69  !7 = !{null, !8}
70  !8 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !9, size: 64, align: 32)
71  !9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
72  !10 = !{!11}
73  !11 = !DILocalVariable(name: "globalptr_arg", arg: 1, scope: !5, file: !1, line: 1, type: !8)
74  !12 = !DILocation(line: 1, column: 42, scope: !5)
75
76...
77---
78name:            long_branch_dbg_value
79tracksRegLiveness: true
80registers:       []
81body:             |
82  bb.0.bb:
83    successors: %bb.1(0x40000000), %bb.4(0x40000000)
84    liveins: $sgpr4_sgpr5
85
86    renamable $sgpr6_sgpr7 = S_LOAD_DWORDX2_IMM renamable $sgpr4_sgpr5, 0, 0, 0 :: (dereferenceable invariant load 8 from %ir.arg.kernarg.offset.cast, align 16, addrspace 4)
87    renamable $sgpr4 = S_LOAD_DWORD_IMM killed renamable $sgpr4_sgpr5, 8, 0, 0 :: (dereferenceable invariant load 4 from %ir.arg1.kernarg.offset.cast, align 8, addrspace 4)
88    S_WAITCNT 49279
89    renamable $vgpr0 = nofpexcept V_MUL_F32_e64 0, killed $sgpr4, 0, $sgpr4, 0, 0, implicit $mode, implicit $exec
90    DBG_VALUE renamable $sgpr6_sgpr7, $noreg, !11, !DIExpression(DW_OP_plus_uconst, 12, DW_OP_stack_value), debug-location !12
91    $vgpr1 = V_MOV_B32_e32 $sgpr6, implicit $exec, implicit-def $vgpr1_vgpr2, implicit $sgpr6_sgpr7
92    $vgpr2 = V_MOV_B32_e32 $sgpr7, implicit $exec, implicit killed $sgpr6_sgpr7, implicit $exec
93    GLOBAL_STORE_DWORD killed renamable $vgpr1_vgpr2, renamable $vgpr0, 12, 0, 0, 0, implicit $exec, debug-location !12 :: (store 4 into %ir.tmp2, addrspace 1)
94    renamable $sgpr4 = S_MOV_B32 8388608
95    renamable $sgpr4_sgpr5 = nofpexcept V_CMP_GT_F32_e64 0, killed $sgpr4, 0, killed $vgpr0, 0, implicit $mode, implicit $exec
96    renamable $vcc = S_AND_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
97    S_CBRANCH_VCCNZ %bb.4, implicit killed $vcc
98
99  bb.1.bb4:
100    successors: %bb.2(0x40000000), %bb.3(0x40000000)
101
102    renamable $sgpr4_sgpr5 = IMPLICIT_DEF
103    $vgpr0 = V_MOV_B32_e32 $sgpr4, implicit $exec, implicit-def $vgpr0_vgpr1, implicit $sgpr4_sgpr5
104    $vgpr1 = V_MOV_B32_e32 $sgpr5, implicit $exec, implicit killed $sgpr4_sgpr5, implicit $exec
105    renamable $vgpr0 = GLOBAL_LOAD_DWORD killed renamable $vgpr0_vgpr1, 0, 0, 0, 0, implicit $exec :: (volatile load 4 from `float addrspace(1)* undef`, addrspace 1)
106    renamable $sgpr4 = S_MOV_B32 2139095040
107    S_WAITCNT 3952
108    renamable $sgpr4_sgpr5 = nofpexcept V_CMP_NEQ_F32_e64 0, killed $sgpr4, 0, killed $vgpr0, 0, implicit $mode, implicit $exec
109    renamable $vcc = S_AND_B64 $exec, killed renamable $sgpr4_sgpr5, implicit-def dead $scc
110    S_CBRANCH_VCCNZ %bb.3, implicit killed $vcc
111
112  bb.2.bb7:
113    successors: %bb.3(0x80000000)
114
115
116  bb.3.Flow:
117    successors: %bb.4(0x80000000)
118
119
120  bb.4.bb8:
121    S_ENDPGM 0
122
123...
124