xref: /llvm-project/llvm/test/DebugInfo/X86/dbg-value-funcarg4.ll (revision d53425e2a33a0ff7336c86d3f668b1855c47a6de)
1; RUN: llc -mtriple=x86_64-unknown-linux-gnu -start-after=codegenprepare -stop-before=finalize-isel -o - %s -experimental-debug-variable-locations=true | FileCheck %s --implicit-check-not=DBG_PHI
2
3; Test that for multiple dbg.values referring to the same argument, we emit a
4; single DBG_PHI and refer to it twice. (Using more than one DBG_PHI is fine,
5; but inefficient).
6
7; CHECK-DAG: ![[LOCAL:.*]] = !DILocalVariable(name: "local"
8; CHECK-DAG: ![[LOCAL2:.*]] = !DILocalVariable(name: "local2"
9
10; CHECK: DBG_PHI $edi, 1
11
12; CHECK: DBG_INSTR_REF ![[LOCAL]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
13; CHECK: DBG_INSTR_REF ![[LOCAL2]], !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0)
14
15declare void @bar(i32)
16declare void @llvm.dbg.value(metadata, metadata, metadata)
17
18define dso_local void @foo_local(i32 %t1a) local_unnamed_addr !dbg !7 {
19entry:
20  tail call void @bar(i32 %t1a) #3, !dbg !17
21  %bees = add i32 %t1a, 3
22  call void @llvm.dbg.value(metadata i32 %t1a, metadata !13, metadata !DIExpression()), !dbg !14
23  call void @llvm.dbg.value(metadata i32 %t1a, metadata !19, metadata !DIExpression()), !dbg !14
24  tail call void @bar(i32 %bees) #3, !dbg !17
25  ret void, !dbg !18
26}
27
28!llvm.dbg.cu = !{!0}
29!llvm.module.flags = !{!3, !4, !5}
30!llvm.ident = !{!6}
31
32!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
33!1 = !DIFile(filename: "foo.c", directory: "")
34!2 = !{}
35!3 = !{i32 2, !"Dwarf Version", i32 4}
36!4 = !{i32 2, !"Debug Info Version", i32 3}
37!5 = !{i32 1, !"wchar_size", i32 4}
38!6 = !{!"clang"}
39!7 = distinct !DISubprogram(name: "foo_local", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
40!8 = !DISubroutineType(types: !9)
41!9 = !{null, !10}
42!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
43!11 = !{!12, !13}
44!12 = !DILocalVariable(name: "t1a", arg: 1, scope: !7, file: !1, line: 3, type: !10)
45!13 = !DILocalVariable(name: "local", scope: !7, file: !1, line: 4, type: !10)
46!14 = !DILocation(line: 3, column: 20, scope: !7)
47!15 = !DILocation(line: 4, column: 7, scope: !7)
48!16 = !DILocation(line: 5, column: 3, scope: !7)
49!17 = !DILocation(line: 7, column: 3, scope: !7)
50!18 = !DILocation(line: 8, column: 1, scope: !7)
51!19 = !DILocalVariable(name: "local2", scope: !7, file: !1, line: 4, type: !10)
52