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