161 lines · plain
1# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST2#3# Test a series of joins, where:4# * The locations agree, although registers have changed,5# * A register down one of the predecessors has been def'd,6# * The register operands to DBG_VALUE_LIST have been swapped,7# * A spurious additional operand has been added to one path,8# * The expressions are not the same (plus -> minus).9#10# Each join block below checks for one DBG_VALUE_LIST: either we re-state the var11# location in a block for the next test, or it's created as a live-in and we12# use that for the next test. Two DBG_VALUE_LISTs in a block would represent13# a live-in that we didn't expect, and a test failure.14#15# Each conditional block should have at least one, possibly two.16#17# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"18#19# CHECK-LABEL: bb.0.entry:20# CHECK: DBG_VALUE_LIST ![[VAR]],21# CHECK-LABEL: bb.1:22# CHECK: DBG_VALUE_LIST ![[VAR]],23# CHECK: DBG_VALUE_LIST ![[VAR]],24# CHECK-LABEL: bb.2:25# CHECK: DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,26# CHECK-SAME: DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi27# CHECK-LABEL: bb.3:28# CHECK: DBG_VALUE_LIST ![[VAR]],29# CHECK-LABEL: bb.4:30# CHECK: DBG_VALUE_LIST ![[VAR]],31# CHECK-SAME: $rdi, $rsi32# CHECK-LABEL: bb.5:33# CHECK: DBG_VALUE_LIST ![[VAR]],34# CHECK: DBG_VALUE_LIST ![[VAR]],35# CHECK-SAME: $rsi, $rdi36# CHECK-LABEL: bb.6:37# CHECK: DBG_VALUE_LIST ![[VAR]],38# CHECK-LABEL: bb.7:39# CHECK: DBG_VALUE_LIST ![[VAR]],40# CHECK: DBG_VALUE_LIST ![[VAR]],41# CHECK-SAME: $rdi, $rsi, $rax42# CHECK-LABEL: bb.8:43# CHECK: DBG_VALUE_LIST ![[VAR]],44# CHECK-LABEL: bb.9:45# CHECK: DBG_VALUE_LIST ![[VAR]],46# CHECK: DBG_VALUE_LIST ![[VAR]],47# CHECK-SAME: DW_OP_minus48# CHECK-LABEL: bb.10:49--- |50 ; ModuleID = 'test.cpp'51 source_filename = "test.cpp"52 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"53 target triple = "x86_64-unknown-linux-gnu"54 55 ; Function Attrs: norecurse nounwind readnone uwtable56 define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {57 entry:58 ret i32 0, !dbg !1759 }60 61 ; Function Attrs: nounwind readnone speculatable willreturn62 declare void @llvm.dbg.value(metadata, metadata, metadata)63 64 !llvm.dbg.cu = !{!0}65 !llvm.module.flags = !{!3, !4, !5}66 !llvm.ident = !{!6}67 68 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)69 !1 = !DIFile(filename: "test.cpp", directory: "/")70 !2 = !{}71 !3 = !{i32 7, !"Dwarf Version", i32 4}72 !4 = !{i32 2, !"Debug Info Version", i32 3}73 !5 = !{i32 1, !"wchar_size", i32 4}74 !6 = !{!"clang version 11.0.0"}75 !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooii", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)76 !8 = !DISubroutineType(types: !9)77 !9 = !{!10, !10, !10}78 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)79 !11 = !{!12, !13, !14}80 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)81 !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)82 !14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)83 !15 = !DILocation(line: 0, scope: !7)84 !16 = !DILocation(line: 4, column: 12, scope: !7)85 !17 = !DILocation(line: 4, column: 3, scope: !7)86 87...88---89name: _Z3fooii90body: |91 bb.0.entry:92 liveins: $rdi, $rsi93 94 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !1595 CMP64ri8 $rdi, 0, implicit-def $eflags96 JCC_1 %bb.2, 4, implicit $eflags97 98 bb.1:99 liveins: $rdi, $rsi100 $rdi = MOV64ri 0101 $rsi = MOV64ri 0102 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15103 104 bb.2:105 liveins: $rdi, $rsi106 ; Should be a live-in loc here,107 CMP64ri8 $rdi, 0, implicit-def $eflags108 JCC_1 %bb.4, 4, implicit $eflags109 110 bb.3:111 liveins: $rdi, $rsi112 $rsi = MOV64ri 0113 114 bb.4:115 liveins: $rdi, $rsi116 ; Should _not_ be a live-in loc here.117 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15118 CMP64ri8 $rdi, 0, implicit-def $eflags119 JCC_1 %bb.6, 4, implicit $eflags120 121 bb.5:122 liveins: $rdi, $rsi123 ; Flip some args,124 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rsi, $rdi, debug-location !15125 126 bb.6:127 liveins: $rdi, $rsi128 ; Should _not_ be a live-in loc here.129 $rax = MOV64ri 0130 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15131 CMP64ri8 $rdi, 0, implicit-def $eflags132 JCC_1 %bb.8, 4, implicit $eflags133 134 bb.7:135 liveins: $rdi, $rsi136 ; Add an extra, spurious, unused argument137 $rax = MOV64ri 1138 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, $rax, debug-location !15139 140 bb.8:141 liveins: $rdi, $rsi142 ; Should _not_ be a live-in loc here.143 $rax = MOV64ri 0144 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15145 CMP64ri8 $rdi, 0, implicit-def $eflags146 JCC_1 %bb.10, 4, implicit $eflags147 148 bb.9:149 liveins: $rdi, $rsi150 ; Replace add with sub in the expr151 $rax = MOV64ri 1152 DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_minus), $rdi, $rsi, debug-location !15153 154 bb.10:155 liveins: $rdi, $rsi156 ; Should _not_ be a live-in loc here.157 RET64158 159...160 161