1# RUN: llc -debug-entry-values -run-pass=livedebugvalues -mtriple=x86_64 -o - %s| FileCheck %s 2# RUN: llc -force-instr-ref-livedebugvalues=1 -debug-entry-values -run-pass=livedebugvalues -mtriple=x86_64 -o - %s| FileCheck %s 3## Test case: 4## int global; 5## int foo(int p, int q, int r) { 6## global = p + 1; 7## asm __volatile("" : : : "edi", "esi", "edx"); 8## return 123; 9## } 10## 11## Verify that DW_OP_LLVM_entry_values are generated for parameters with multiple 12## DBG_VALUEs at entry block. 13# CHECK: DBG_VALUE $edi, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} 14# CHECK: INLINEASM 15# CHECK-DAG: DBG_VALUE $esi, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} 16# CHECK-DAG: DBG_VALUE $edx, $noreg, !{{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location {{.*}} 17# CHECK $eax = MOV32ri 123 18 19--- | 20 ; ModuleID = 'multiple-param-dbg-value-entry.ll' 21 source_filename = "multiple-param-dbg-value-entry.c" 22 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 23 24 @global = common dso_local local_unnamed_addr global i32 0, align 4, !dbg !0 25 26 define dso_local i32 @foo(i32 %p, i32 %q, i32 %r) local_unnamed_addr !dbg !11 { 27 entry: 28 call void @llvm.dbg.value(metadata i32 %p, metadata !15, metadata !DIExpression()), !dbg !18 29 call void @llvm.dbg.value(metadata i32 %q, metadata !16, metadata !DIExpression()), !dbg !18 30 call void @llvm.dbg.value(metadata i32 %r, metadata !17, metadata !DIExpression()), !dbg !18 31 %add = add nsw i32 %p, 1, !dbg !18 32 store i32 %add, ptr @global, align 4, !dbg !18 33 tail call void asm sideeffect "", "~{edi},~{esi},~{edx},~{dirflag},~{fpsr},~{flags}"(), !dbg !18, !srcloc !19 34 ret i32 123, !dbg !18 35 } 36 37 ; Function Attrs: nounwind readnone speculatable 38 declare void @llvm.dbg.value(metadata, metadata, metadata) 39 40 !llvm.dbg.cu = !{!2} 41 !llvm.module.flags = !{!7, !8, !9} 42 !llvm.ident = !{!10} 43 44 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 45 !1 = distinct !DIGlobalVariable(name: "global", scope: !2, file: !3, line: 8, type: !6, isLocal: false, isDefinition: true) 46 !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) 47 !3 = !DIFile(filename: "multiple-param-dbg-value-entry.c", directory: "/") 48 !4 = !{} 49 !5 = !{!0} 50 !6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 51 !7 = !{i32 2, !"Dwarf Version", i32 4} 52 !8 = !{i32 2, !"Debug Info Version", i32 3} 53 !9 = !{i32 1, !"wchar_size", i32 4} 54 !10 = !{!"clang version 9.0.0 "} 55 !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) 56 !12 = !DISubroutineType(types: !13) 57 !13 = !{!6, !6, !6, !6} 58 !14 = !{!15, !16, !17} 59 !15 = !DILocalVariable(name: "p", arg: 1, scope: !11, file: !3, line: 9, type: !6) 60 !16 = !DILocalVariable(name: "q", arg: 2, scope: !11, file: !3, line: 9, type: !6) 61 !17 = !DILocalVariable(name: "r", arg: 3, scope: !11, file: !3, line: 9, type: !6) 62 !18 = !DILocation(line: 9, column: 13, scope: !11) 63 !19 = !{i32 213} 64 65... 66--- 67name: foo 68alignment: 16 69tracksRegLiveness: true 70liveins: 71 - { reg: '$edi' } 72body: | 73 bb.0.entry: 74 liveins: $edi 75 76 DBG_VALUE $edi, $noreg, !15, !DIExpression(), debug-location !18 77 DBG_VALUE $esi, $noreg, !16, !DIExpression(), debug-location !18 78 DBG_VALUE $edx, $noreg, !17, !DIExpression(), debug-location !18 79 renamable $edi = nsw INC32r killed renamable $edi, implicit-def dead $eflags, debug-location !18 80 MOV32mr $rip, 1, $noreg, @global, $noreg, killed renamable $edi, debug-location !18 :: (store (s32) into @global) 81 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 82 $eax = MOV32ri 123, debug-location !18 83 RET64 killed $eax, debug-location !18 84 85... 86