1 # RUN: llc -debug-entry-values -run-pass=livedebugvalues -o - %s | FileCheck %s
3 # Verify that the entry values for the input parameters are inserted after the
4 # bundles which contains the registers' clobbering instructions (the calls to
5 # @clobber). Previously the insertions would thrash the bundles, later on
6 # triggering a crash in DebugHandlerBase.
9 target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
10 target triple = "hexagon"
12 ; Function Attrs: nounwind
13 define i32 @foo(i32 %arg) !dbg !12 {
15 call void @llvm.dbg.value(metadata i32 %arg, metadata !16, metadata !DIExpression()), !dbg !17
16 %call = tail call i32 @clobber(), !dbg !18
20 declare !dbg !4 i32 @clobber()
22 ; Function Attrs: nounwind
23 define i32 @bar(i32 %b) !dbg !20 {
25 call void @llvm.dbg.value(metadata i32 %b, metadata !22, metadata !DIExpression()), !dbg !23
26 %tobool = icmp eq i32 %b, 0, !dbg !24
27 br i1 %tobool, label %land.end, label %land.rhs, !dbg !24
29 land.rhs: ; preds = %entry
30 %call = tail call i32 @clobber(), !dbg !25
33 land.end: ; preds = %entry, %land.rhs
34 ret i32 undef, !dbg !27
37 ; Function Attrs: nounwind readnone speculatable
38 declare void @llvm.dbg.value(metadata, metadata, metadata) #0
40 attributes #0 = { nounwind readnone speculatable }
43 !llvm.module.flags = !{!8, !9, !10}
46 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
47 !1 = !DIFile(filename: "foo.c", directory: "/")
50 !4 = !DISubprogram(name: "clobber", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
51 !5 = !DISubroutineType(types: !6)
53 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
54 !8 = !{i32 2, !"Dwarf Version", i32 4}
55 !9 = !{i32 2, !"Debug Info Version", i32 3}
56 !10 = !{i32 1, !"wchar_size", i32 4}
57 !11 = !{!"clang version 10.0.0"}
58 !12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !13, scopeLine: 3, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
59 !13 = !DISubroutineType(types: !14)
62 !16 = !DILocalVariable(name: "arg", arg: 1, scope: !12, file: !1, line: 3, type: !7, flags: DIFlagArgumentNotModified)
63 !17 = !DILocation(line: 0, scope: !12)
64 !18 = !DILocation(line: 4, scope: !12)
65 !19 = !DILocation(line: 5, scope: !12)
66 !20 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 8, type: !13, scopeLine: 8, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !21)
68 !22 = !DILocalVariable(name: "arg", arg: 1, scope: !20, file: !1, line: 8, type: !7, flags: DIFlagArgumentNotModified)
69 !23 = !DILocation(line: 0, scope: !20)
70 !24 = !DILocation(line: 9, scope: !20)
71 !25 = !DILocation(line: 9, scope: !26)
72 !26 = distinct !DILexicalBlock(scope: !20, file: !1, line: 9)
73 !27 = !DILocation(line: 10, scope: !20)
78 tracksRegLiveness: true
81 DBG_VALUE $r0, $noreg, !16, !DIExpression(), debug-location !17
82 CFI_INSTRUCTION def_cfa $r30, 8
83 CFI_INSTRUCTION offset $r31, -4
84 CFI_INSTRUCTION offset $r30, -8
85 BUNDLE implicit-def $r29, implicit-def $r30, implicit-def dead $pc, implicit-def dead $r31, implicit-def dead $r0, implicit $r29, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, debug-location !18 {
86 $r29 = S2_allocframe $r29, 0, implicit-def $r30, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, debug-location !18 :: (store 4 into stack)
87 J2_call @clobber, hexagoncsr, implicit-def dead $pc, implicit-def dead $r31, implicit internal killed $r29, implicit-def $r29, implicit-def dead $r0, debug-location !18
89 BUNDLE implicit-def dead $r0, implicit-def $d15, implicit-def $r30, implicit-def $r31, implicit-def $pc, implicit-def $r29, implicit killed $r30, implicit killed $framekey, debug-location !19 {
90 $r0 = A2_tfrsi 1, debug-location !19
91 $d15 = L4_return killed $r30, implicit-def $pc, implicit-def $r29, implicit killed $framekey, implicit-def dead $pc, implicit internal killed $r0, debug-location !19
96 # CHECK-LABEL: name: foo
98 # CHECK-NEXT: $r29 = S2_allocframe $r29, 0
99 # CHECK-NEXT: J2_call @clobber
101 # CHECK-NEXT: DBG_VALUE $r0, $noreg, !16, !DIExpression(DW_OP_LLVM_entry_value, 1)
105 tracksRegLiveness: true
113 DBG_VALUE $r0, $noreg, !22, !DIExpression(), debug-location !23
114 DBG_VALUE $r0, $noreg, !22, !DIExpression(), debug-location !23
115 BUNDLE implicit-def dead $p0, implicit-def $pc, implicit killed $r0, implicit killed $r31, debug-location !24 {
116 renamable $p0 = C2_cmpeqi killed renamable $r0, 0, debug-location !24
117 PS_jmprettnew internal killed $p0, killed $r31, implicit-def $pc, implicit-def $pc, implicit killed undef $r0, debug-location !27
121 CFI_INSTRUCTION def_cfa $r30, 8
122 CFI_INSTRUCTION offset $r31, -4
123 CFI_INSTRUCTION offset $r30, -8
124 BUNDLE implicit-def $r29, implicit-def $r30, implicit-def $pc, implicit-def $r31, implicit-def dead $r0, implicit $r29, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, debug-location !25 {
125 $r29 = S2_allocframe $r29, 0, implicit-def $r30, implicit killed $framekey, implicit killed $framelimit, implicit killed $r30, implicit killed $r31, debug-location !25 :: (store 4 into stack)
126 J2_call @clobber, hexagoncsr, implicit-def $pc, implicit-def $r31, implicit internal killed $r29, implicit-def $r29, implicit-def dead $r0, debug-location !25
128 $d15 = L2_deallocframe killed $r30, implicit-def $r29, implicit killed $framekey
129 PS_jmpret killed $r31, implicit-def $pc, implicit killed undef $r0, debug-location !27
133 # CHECK-LABEL: name: bar
136 # CHECK-NEXT: $r29 = S2_allocframe $r29, 0
137 # CHECK-NEXT: J2_call @clobber
139 # CHECK-NEXT: DBG_VALUE $r0, $noreg, !22, !DIExpression(DW_OP_LLVM_entry_value, 1)