Compiler projects using llvm
# RUN: llc -mtriple=x86_64-- -run-pass livedebugvalues -o - %s -experimental-debug-variable-locations=false | FileCheck %s --implicit-check-not=DBG_VALUE_LIST
#
# Test that even after a move, clobbering a register terminates a DBG_VALUE_LIST.
# Check the same for DBG_VALUE $noreg.
#
# CHECK: ![[VAR:[0-9]+]] = !DILocalVariable(name: "c"
# 
# CHECK-LABEL: bb.0.entry:
# CHECK:       DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME:                        DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi
# CHECK:       $rbx = COPY killed $rdi
# CHECK-NEXT:  DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME:                        DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK-LABEL: bb.1:
# CHECK:       DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME:                        DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK:       $rsi = MOV64ri 0
# CHECK-LABEL: bb.2:
# no live-in!
# CHECK:       $rsi = MOV64ri 0
# CHECK-NEXT:  DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME:                        DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# CHECK-LABEL: bb.3:
# CHECK:       DBG_VALUE_LIST ![[VAR]], !DIExpression(DW_OP_LLVM_arg, 0,
# CHECK-SAME:                        DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi
# live-in to bb.3, then explicitly undef'd, should be no further locations
# propagated.
# CHECK-LABEL: bb.4:
--- |
  ; ModuleID = 'test.cpp'
  source_filename = "test.cpp"
  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: norecurse nounwind readnone uwtable
  define dso_local i32 @_Z3fooii(i32 %a, i32 %b) local_unnamed_addr !dbg !7 {
  entry:
    ret i32 0, !dbg !17
  }
  
  ; Function Attrs: nounwind readnone speculatable willreturn
  declare void @llvm.dbg.value(metadata, metadata, metadata)
  
  !llvm.dbg.cu = !{!0}
  !llvm.module.flags = !{!3, !4, !5}
  !llvm.ident = !{!6}
  
  !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)
  !1 = !DIFile(filename: "test.cpp", directory: "/")
  !2 = !{}
  !3 = !{i32 7, !"Dwarf Version", i32 4}
  !4 = !{i32 2, !"Debug Info Version", i32 3}
  !5 = !{i32 1, !"wchar_size", i32 4}
  !6 = !{!"clang version 11.0.0"}
  !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)
  !8 = !DISubroutineType(types: !9)
  !9 = !{!10, !10, !10}
  !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
  !11 = !{!12, !13, !14}
  !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
  !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
  !14 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 3, type: !10)
  !15 = !DILocation(line: 0, scope: !7)
  !16 = !DILocation(line: 4, column: 12, scope: !7)
  !17 = !DILocation(line: 4, column: 3, scope: !7)

...
---
name:            _Z3fooii
fixedStack:
  - { id: 0, type: spill-slot, offset: -32, size: 8, alignment: 16, stack-id: default,
      callee-saved-register: '$rbx', callee-saved-restored: true }
  - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 16, stack-id: default,
      callee-saved-register: '$rbp', callee-saved-restored: true }
body:             |
  bb.0.entry:
    liveins: $rdi, $rsi
  
    DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rdi, $rsi, debug-location !15
    $rbx = COPY killed $rdi
    $rdi = MOV64ri 0
    JMP_1 %bb.1

  bb.1:
    liveins: $rbx, $rsi
    $rsi = MOV64ri 0
    JMP_1 %bb.2

  bb.2:
    liveins: $rbx, $rsi

    $rsi = MOV64ri 0
    DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus), $rbx, $rsi, debug-location !15
    JMP_1 %bb.3

  bb.3:
    liveins: $rbx, $rsi
    DBG_VALUE $noreg, $noreg, !14, !DIExpression(), debug-location !15
    JMP_1 %bb.4

  bb.4:
    liveins: $rbx, $rsi
    RET64 $rbx, debug-location !17

...