1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
|
# RUN: llc -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
# RUN: llc -force-instr-ref-livedebugvalues=1 -run-pass=livedebugvalues -march=x86-64 -o - %s | FileCheck %s
#
#extern void fn1 (int, int, int);
#__attribute__((noinline))
#int
#fn2 (int a, int b, int c) {
# int q = 2 + a;
# fn1 (5, 6, q);
# if (b < 17) {
# b = b + 7;
# fn1 (5, b, q);
# } else {
# b = b + 1;
# fn1 (1, b, q);
# }
# return b;
#}
# CHECK: ![[ARG_C:.*]] = !DILocalVariable(name: "c"
# CHECK: bb.0.entry:
# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK: bb.1.if.then:
# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK: bb.2.if.else:
# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
# CHECK: bb.3.if.end:
# CHECK: DBG_VALUE $edx, $noreg, ![[ARG_C]], !DIExpression(DW_OP_LLVM_entry_value, 1)
#
--- |
; ModuleID = 'test.c'
source_filename = "test.c"
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: noinline nounwind uwtable
define dso_local i32 @fn2(i32 %a, i32 %b, i32 %c) local_unnamed_addr !dbg !12 {
entry:
call void @llvm.dbg.value(metadata i32 %a, metadata !16, metadata !DIExpression()), !dbg !20
call void @llvm.dbg.value(metadata i32 %b, metadata !17, metadata !DIExpression()), !dbg !20
call void @llvm.dbg.value(metadata i32 %c, metadata !18, metadata !DIExpression()), !dbg !20
%add = add nsw i32 %a, 2, !dbg !21
call void @llvm.dbg.value(metadata i32 %add, metadata !19, metadata !DIExpression()), !dbg !20
tail call void @fn1(i32 5, i32 6, i32 %add), !dbg !22
%cmp = icmp slt i32 %b, 17, !dbg !23
br i1 %cmp, label %if.then, label %if.else, !dbg !25
if.then: ; preds = %entry
%add1 = add nsw i32 %b, 7, !dbg !26
call void @llvm.dbg.value(metadata i32 %add1, metadata !17, metadata !DIExpression()), !dbg !20
tail call void @fn1(i32 5, i32 %add1, i32 %add), !dbg !28
br label %if.end, !dbg !29
if.else: ; preds = %entry
%add2 = add nuw nsw i32 %b, 1, !dbg !30
call void @llvm.dbg.value(metadata i32 %add2, metadata !17, metadata !DIExpression()), !dbg !20
tail call void @fn1(i32 1, i32 %add2, i32 %add), !dbg !32
br label %if.end
if.end: ; preds = %if.else, %if.then
%b.addr.0 = phi i32 [ %add1, %if.then ], [ %add2, %if.else ], !dbg !33
call void @llvm.dbg.value(metadata i32 %b.addr.0, metadata !17, metadata !DIExpression()), !dbg !20
ret i32 %b.addr.0, !dbg !34
}
declare !dbg !4 dso_local void @fn1(i32, i32, i32) local_unnamed_addr
; Function Attrs: nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9, !10}
!llvm.ident = !{!11}
!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)
!1 = !DIFile(filename: "test.c", directory: "/")
!2 = !{}
!3 = !{!4}
!4 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
!5 = !DISubroutineType(types: !6)
!6 = !{null, !7, !7, !7}
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!8 = !{i32 2, !"Dwarf Version", i32 4}
!9 = !{i32 2, !"Debug Info Version", i32 3}
!10 = !{i32 1, !"wchar_size", i32 4}
!11 = !{!"clang version 10.0.0"}
!12 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 5, type: !13, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15)
!13 = !DISubroutineType(types: !14)
!14 = !{!7, !7, !7, !7}
!15 = !{!16, !17, !18, !19}
!16 = !DILocalVariable(name: "a", arg: 1, scope: !12, file: !1, line: 5, type: !7)
!17 = !DILocalVariable(name: "b", arg: 2, scope: !12, file: !1, line: 5, type: !7)
!18 = !DILocalVariable(name: "c", arg: 3, scope: !12, file: !1, line: 5, type: !7)
!19 = !DILocalVariable(name: "q", scope: !12, file: !1, line: 7, type: !7)
!20 = !DILocation(line: 0, scope: !12)
!21 = !DILocation(line: 7, column: 15, scope: !12)
!22 = !DILocation(line: 9, column: 5, scope: !12)
!23 = !DILocation(line: 11, column: 11, scope: !24)
!24 = distinct !DILexicalBlock(scope: !12, file: !1, line: 11, column: 9)
!25 = !DILocation(line: 11, column: 9, scope: !12)
!26 = !DILocation(line: 12, column: 13, scope: !27)
!27 = distinct !DILexicalBlock(scope: !24, file: !1, line: 11, column: 17)
!28 = !DILocation(line: 13, column: 8, scope: !27)
!29 = !DILocation(line: 14, column: 5, scope: !27)
!30 = !DILocation(line: 15, column: 13, scope: !31)
!31 = distinct !DILexicalBlock(scope: !24, file: !1, line: 14, column: 12)
!32 = !DILocation(line: 16, column: 7, scope: !31)
!33 = !DILocation(line: 0, scope: !24)
!34 = !DILocation(line: 19, column: 5, scope: !12)
...
---
name: fn2
alignment: 16
body: |
bb.0.entry:
successors: %bb.1(0x40000000), %bb.2(0x40000000)
liveins: $edi, $esi, $rbp, $rbx
DBG_VALUE $edi, $noreg, !16, !DIExpression(), debug-location !20
DBG_VALUE $esi, $noreg, !17, !DIExpression(), debug-location !20
DBG_VALUE $edx, $noreg, !18, !DIExpression(), debug-location !20
frame-setup PUSH64r killed $rbp, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 16
frame-setup PUSH64r killed $rbx, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 24
frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
CFI_INSTRUCTION def_cfa_offset 32
CFI_INSTRUCTION offset $rbx, -24
CFI_INSTRUCTION offset $rbp, -16
$ebx = MOV32rr $esi
DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20
$ebp = MOV32rr $edi
DBG_VALUE $ebp, $noreg, !16, !DIExpression(), debug-location !20
renamable $ebp = nsw ADD32ri8 killed renamable $ebp, 2, implicit-def dead $eflags, debug-location !21
DBG_VALUE $ebp, $noreg, !19, !DIExpression(), debug-location !20
$edi = MOV32ri 5, debug-location !22
$esi = MOV32ri 6, debug-location !22
$edx = MOV32rr $ebp, debug-location !22
CALL64pcrel32 @fn1, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit killed $edx, implicit-def $rsp, implicit-def $ssp, debug-location !22
CMP32ri8 renamable $ebx, 16, implicit-def $eflags, debug-location !23
JCC_1 %bb.2, 15, implicit killed $eflags, debug-location !25
bb.1.if.then:
successors: %bb.3(0x80000000)
liveins: $ebp, $ebx
renamable $ebx = nsw ADD32ri8 killed renamable $ebx, 7, implicit-def dead $eflags, debug-location !26
DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20
$edi = MOV32ri 5, debug-location !28
JMP_1 %bb.3
bb.2.if.else:
successors: %bb.3(0x80000000)
liveins: $ebp, $ebx
renamable $ebx = nuw nsw ADD32ri8 killed renamable $ebx, 1, implicit-def dead $eflags, debug-location !30
DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20
$edi = MOV32ri 1, debug-location !32
bb.3.if.end:
liveins: $ebx, $edi, $ebp
$esi = MOV32rr $ebx, debug-location !33
$edx = MOV32rr killed $ebp, debug-location !33
CALL64pcrel32 @fn1, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit $esi, implicit killed $edx, implicit-def $rsp, implicit-def $ssp, debug-location !33
DBG_VALUE $ebx, $noreg, !17, !DIExpression(), debug-location !20
$eax = MOV32rr killed $ebx, debug-location !34
$rsp = frame-destroy ADD64ri8 $rsp, 8, implicit-def dead $eflags, debug-location !34
CFI_INSTRUCTION def_cfa_offset 24, debug-location !34
$rbx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !34
CFI_INSTRUCTION def_cfa_offset 16, debug-location !34
$rbp = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !34
CFI_INSTRUCTION def_cfa_offset 8, debug-location !34
RET64 killed $eax, debug-location !34
...
|