Compiler projects using llvm
# RUN: llc -march=x86-64 -run-pass machineverifier -o - %s | FileCheck %s
# Simple round-trip test for DBG_VALUE_LIST.
# CHECK: [[VAR_C:![0-9]+]] = !DILocalVariable(name: "c"
# CHECK: DBG_VALUE_LIST [[VAR_C]], !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location
--- |
  ; 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:
    call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !15
    call void @llvm.dbg.value(metadata i32 %b, metadata !13, metadata !DIExpression()), !dbg !15
    call void @llvm.dbg.value(metadata i32 undef, metadata !14, metadata !DIExpression()), !dbg !15
    %mul = mul nsw i32 %b, %a, !dbg !16
    ret i32 %mul, !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
body:             |
  bb.0.entry:
    liveins: $edi, $esi
  
    DBG_VALUE $edi, $noreg, !12, !DIExpression(), debug-location !15
    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
    $eax = MOV32rr $edi
    DBG_VALUE_LIST !14, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_arg, 1, DW_OP_plus, DW_OP_stack_value), $edi, $esi, debug-location !15
    DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !15
    DBG_VALUE $eax, $noreg, !12, !DIExpression(), debug-location !15
    renamable $eax = nsw IMUL32rr killed renamable $eax, killed renamable $esi, implicit-def dead $eflags, debug-location !16
    RET64 $eax, debug-location !17

...