1# RUN: llc -start-before=livedebugvalues -mtriple=x86_64-apple-darwin -o %t %s -filetype=obj
2# RUN: llvm-dwarfdump %t | FileCheck %s
3
4# RUN: llc -start-before=livedebugvalues -debugger-tune=sce -mtriple=x86_64-sce-ps4 -o %t1 %s -filetype=obj
5# RUN: llvm-dwarfdump %t1 | FileCheck %s -check-prefix=SCE
6
7## Based on:
8## int global;
9## int foo(int p, int q, int r) {
10##   global = p + 1;
11##   asm __volatile("" : : : "edi", "esi", "edx");
12##   return 123;
13## }
14
15# CHECK: DW_TAG_formal_parameter
16# CHECK:   DW_OP_entry_value
17
18# SCE-NOT: DW_OP_{{.*}}entry_value
19
20--- |
21  ; ModuleID = 'multiple-param-dbg-value-entry.ll'
22  source_filename = "multiple-param-dbg-value-entry.c"
23  target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
24
25  @global = common dso_local local_unnamed_addr global i32 0, align 4, !dbg !0
26
27  define dso_local i32 @foo(i32 %p, i32 %q, i32 %r) local_unnamed_addr !dbg !11 {
28  entry:
29    call void @llvm.dbg.value(metadata i32 %p, metadata !15, metadata !DIExpression()), !dbg !18
30    call void @llvm.dbg.value(metadata i32 %q, metadata !16, metadata !DIExpression()), !dbg !18
31    call void @llvm.dbg.value(metadata i32 %r, metadata !17, metadata !DIExpression()), !dbg !18
32    %add = add nsw i32 %p, 1, !dbg !18
33    store i32 %add, i32* @global, align 4, !dbg !18
34    tail call void asm sideeffect "", "~{edi},~{esi},~{edx},~{dirflag},~{fpsr},~{flags}"(), !dbg !18, !srcloc !19
35    ret i32 123, !dbg !18
36  }
37
38  ; Function Attrs: nounwind readnone speculatable
39  declare void @llvm.dbg.value(metadata, metadata, metadata)
40
41  !llvm.dbg.cu = !{!2}
42  !llvm.module.flags = !{!7, !8, !9}
43  !llvm.ident = !{!10}
44
45  !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
46  !1 = distinct !DIGlobalVariable(name: "global", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true)
47  !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 9.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
48  !3 = !DIFile(filename: "multiple-param-dbg-value-entry.c", directory: "/")
49  !4 = !{}
50  !5 = !{!0}
51  !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
52  !7 = !{i32 2, !"Dwarf Version", i32 4}
53  !8 = !{i32 2, !"Debug Info Version", i32 3}
54  !9 = !{i32 1, !"wchar_size", i32 4}
55  !10 = !{!"clang version 9.0.0 "}
56  !11 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 9, type: !12, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !14)
57  !12 = !DISubroutineType(types: !13)
58  !13 = !{!6, !6, !6, !6}
59  !14 = !{!15, !16, !17}
60  !15 = !DILocalVariable(name: "p", arg: 1, scope: !11, file: !3, line: 9, type: !6)
61  !16 = !DILocalVariable(name: "q", arg: 2, scope: !11, file: !3, line: 9, type: !6)
62  !17 = !DILocalVariable(name: "r", arg: 3, scope: !11, file: !3, line: 9, type: !6)
63  !18 = !DILocation(line: 9, column: 13, scope: !11)
64  !19 = !{i32 213}
65
66...
67---
68name:            foo
69alignment:       16
70tracksRegLiveness: true
71liveins:
72  - { reg: '$edi' }
73body:             |
74  bb.0.entry:
75    liveins: $edi
76
77    DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !18
78    DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !18
79    DBG_VALUE $esi, $noreg, !16, !DIExpression(), debug-location !18
80    DBG_VALUE $edx, $noreg, !17, !DIExpression(), debug-location !18
81    renamable $edi = nsw INC32r killed renamable $edi, implicit-def dead $eflags, debug-location !18
82    MOV32mr $rip, 1, $noreg, @global, $noreg, killed renamable $edi, debug-location !18 :: (store 4 into @global)
83    INLINEASM &"", 1, 12, implicit-def dead early-clobber $edi, 12, implicit-def dead early-clobber $esi, 12, implicit-def dead early-clobber $edx, 12, implicit-def dead early-clobber $df, 12, implicit-def dead early-clobber $fpsw, 12, implicit-def dead early-clobber $eflags, !19, debug-location !18
84    $eax = MOV32ri 123, debug-location !18
85    RETQ killed $eax, debug-location !18
86
87...
88