1# RUN: llc -run-pass=livedebugvalues -emit-call-site-info -o - \ 2# RUN: %s -experimental-debug-variable-locations=false | FileCheck %s 3 4## Test from PR47628. 5## Compiled from source: 6## extern void bar(int); 7## extern int side_effect, value; 8## int foo(int param) { 9## side_effect = param; 10## param = value; 11## bar(param); 12## return 0; 13## } 14## Using command: 15## $ clang m.c -O1 -g -c -mllvm -stop-before=livedebugvalues 16 17## Confirm that Backup Entry Value is not used for modified parameter "param". 18 19# CHECK: ![[PARAM:.*]] = !DILocalVariable(name: "param" 20# CHECK: renamable $edi = MOV32rm $rip, 1, $noreg 21# CHECK-NOT: DBG_VALUE $edi, $noreg, ![[PARAM]], !DIExpression(DW_OP_LLVM_entry_value, 1) 22# CHECK-NEXT: DBG_VALUE $edi, $noreg, ![[PARAM]], !DIExpression() 23# CHECK-NEXT: CALL64pcrel32 @bar 24# CHECK-NOT: DBG_VALUE $edi, $noreg, ![[PARAM]], !DIExpression(DW_OP_LLVM_entry_value, 1) 25 26--- | 27 ; ModuleID = 'm.c' 28 source_filename = "m.c" 29 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 30 target triple = "x86_64-unknown-linux-gnu" 31 32 @side_effect = external dso_local local_unnamed_addr global i32, align 4 33 @value = external dso_local local_unnamed_addr global i32, align 4 34 35 ; Function Attrs: nounwind uwtable 36 define dso_local i32 @foo(i32 %param) local_unnamed_addr !dbg !8 { 37 entry: 38 call void @llvm.dbg.value(metadata i32 %param, metadata !13, metadata !DIExpression()), !dbg !14 39 store i32 %param, ptr @side_effect, align 4, !dbg !15, !tbaa !16 40 %0 = load i32, ptr @value, align 4, !dbg !20, !tbaa !16 41 call void @llvm.dbg.value(metadata i32 %0, metadata !13, metadata !DIExpression()), !dbg !14 42 call void @bar(i32 %0), !dbg !21 43 ret i32 0, !dbg !22 44 } 45 46 declare !dbg !23 dso_local void @bar(i32) local_unnamed_addr 47 48 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 49 declare void @llvm.dbg.value(metadata, metadata, metadata) 50 51 !llvm.dbg.cu = !{!0} 52 !llvm.module.flags = !{!3, !4, !5, !6} 53 !llvm.ident = !{!7} 54 55 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 56 !1 = !DIFile(filename: "m.c", directory: "/dir") 57 !2 = !{} 58 !3 = !{i32 7, !"Dwarf Version", i32 4} 59 !4 = !{i32 2, !"Debug Info Version", i32 3} 60 !5 = !{i32 1, !"wchar_size", i32 4} 61 !6 = !{i32 7, !"uwtable", i32 1} 62 !7 = !{!"clang version 13.0.0"} 63 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 4, type: !9, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !12) 64 !9 = !DISubroutineType(types: !10) 65 !10 = !{!11, !11} 66 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 67 !12 = !{!13} 68 !13 = !DILocalVariable(name: "param", arg: 1, scope: !8, file: !1, line: 4, type: !11) 69 !14 = !DILocation(line: 0, scope: !8) 70 !15 = !DILocation(line: 5, column: 17, scope: !8) 71 !16 = !{!17, !17, i64 0} 72 !17 = !{!"int", !18, i64 0} 73 !18 = !{!"omnipotent char", !19, i64 0} 74 !19 = !{!"Simple C/C++ TBAA"} 75 !20 = !DILocation(line: 6, column: 13, scope: !8) 76 !21 = !DILocation(line: 7, column: 5, scope: !8) 77 !22 = !DILocation(line: 8, column: 5, scope: !8) 78 !23 = !DISubprogram(name: "bar", scope: !1, file: !1, line: 1, type: !24, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 79 !24 = !DISubroutineType(types: !25) 80 !25 = !{null, !11} 81 82... 83--- 84name: foo 85alignment: 16 86liveins: 87 - { reg: '$edi', virtual-reg: '' } 88callSites: 89 - { bb: 0, offset: 6, fwdArgRegs: 90 - { arg: 0, reg: '$edi' } } 91body: | 92 bb.0.entry: 93 liveins: $edi 94 95 DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14 96 frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp 97 CFI_INSTRUCTION def_cfa_offset 16 98 MOV32mr $rip, 1, $noreg, @side_effect, $noreg, killed renamable $edi, debug-location !15 :: (store 4 into @side_effect, !tbaa !16) 99 renamable $edi = MOV32rm $rip, 1, $noreg, @value, $noreg, debug-location !20 :: (dereferenceable load 4 from @value, !tbaa !16) 100 DBG_VALUE $edi, $noreg, !13, !DIExpression(), debug-location !14 101 CALL64pcrel32 @bar, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, debug-location !21 102 $eax = XOR32rr undef $eax, undef $eax, implicit-def dead $eflags, debug-location !22 103 $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp, debug-location !22 104 CFI_INSTRUCTION def_cfa_offset 8, debug-location !22 105 RET64 killed $eax, debug-location !22 106 107... 108