124 lines · plain
1# RUN: llc -run-pass=greedy -run-pass=virtregrewriter %s -o - | FileCheck %s2 3## This tests that LiveDebugVariables does not trim non-inlined variable4## location.5 6# CHECK: ![[VARA:.*]] = !DILocalVariable(name: "a"7# CHECK: ![[VARB:.*]] = !DILocalVariable(name: "b"8# CHECK: ![[VARC:.*]] = !DILocalVariable(name: "c"9# CHECK: $at = COPY $a210# CHECK-NEXT: DBG_VALUE $at, $noreg, ![[VARC]], !DIExpression(), debug-location11# CHECK: $s0 = COPY $a112# CHECK-NEXT: DBG_VALUE $a0, $noreg, ![[VARA]], !DIExpression(), debug-location13# CHECK-NEXT: DBG_VALUE $s0, $noreg, ![[VARB]], !DIExpression(), debug-location14 15--- |16 ; ModuleID = 'test.c'17 source_filename = "test.c"18 target datalayout = "E-m:m-p:32:32-i8:8:32-i16:16:32-i64:64-n32-S64"19 target triple = "mips-unknown-linux-gnu"20 21 ; Function Attrs: nounwind22 define dso_local i32 @fn2(i32 signext %a, i32 signext %b, i32 signext %c) local_unnamed_addr !dbg !7 {23 entry:24 call void @llvm.dbg.value(metadata i32 %a, metadata !12, metadata !DIExpression()), !dbg !1625 call void @llvm.dbg.value(metadata i32 %b, metadata !13, metadata !DIExpression()), !dbg !1626 call void @llvm.dbg.value(metadata i32 %c, metadata !14, metadata !DIExpression()), !dbg !1627 %add = add nsw i32 %b, %a, !dbg !1728 %add1 = add nsw i32 %b, 10, !dbg !1829 %call = tail call i32 @fn1(i32 signext %add, i32 signext %c, i32 signext %add1), !dbg !1930 call void @llvm.dbg.value(metadata i32 %call, metadata !15, metadata !DIExpression()), !dbg !1631 %cmp = icmp sgt i32 %call, 10, !dbg !2032 %add2 = add nsw i32 %call, 10, !dbg !2233 %retval.0 = select i1 %cmp, i32 %add2, i32 %b, !dbg !2234 ret i32 %retval.0, !dbg !2335 }36 37 declare !dbg !24 dso_local i32 @fn1(i32 signext, i32 signext, i32 signext) local_unnamed_addr38 39 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn mustprogress40 declare void @llvm.dbg.value(metadata, metadata, metadata)41 42 !llvm.dbg.cu = !{!0}43 !llvm.module.flags = !{!3, !4, !5}44 !llvm.ident = !{!6}45 46 !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)47 !1 = !DIFile(filename: "test.c", directory: "/dir")48 !2 = !{}49 !3 = !{i32 7, !"Dwarf Version", i32 4}50 !4 = !{i32 2, !"Debug Info Version", i32 3}51 !5 = !{i32 1, !"wchar_size", i32 4}52 !6 = !{!"clang version 13.0.0"}53 !7 = distinct !DISubprogram(name: "fn2", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)54 !8 = !DISubroutineType(types: !9)55 !9 = !{!10, !10, !10, !10}56 !10 = !DIBasicType(name: "long int", size: 32, encoding: DW_ATE_signed)57 !11 = !{!12, !13, !14, !15}58 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)59 !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)60 !14 = !DILocalVariable(name: "c", arg: 3, scope: !7, file: !1, line: 2, type: !10)61 !15 = !DILocalVariable(name: "local", scope: !7, file: !1, line: 3, type: !10)62 !16 = !DILocation(line: 0, scope: !7)63 !17 = !DILocation(line: 3, column: 22, scope: !7)64 !18 = !DILocation(line: 3, column: 30, scope: !7)65 !19 = !DILocation(line: 3, column: 17, scope: !7)66 !20 = !DILocation(line: 4, column: 14, scope: !21)67 !21 = distinct !DILexicalBlock(scope: !7, file: !1, line: 4, column: 8)68 !22 = !DILocation(line: 4, column: 8, scope: !7)69 !23 = !DILocation(line: 7, column: 2, scope: !7)70 !24 = !DISubprogram(name: "fn1", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)71 72...73---74name: fn275alignment: 476tracksRegLiveness: true77frameInfo:78 adjustsStack: true79registers:80 - { id: 0, class: gpr32, preferred-register: '' }81 - { id: 1, class: gpr32, preferred-register: '' }82 - { id: 2, class: gpr32, preferred-register: '' }83 - { id: 3, class: gpr32, preferred-register: '' }84 - { id: 4, class: gpr32, preferred-register: '' }85 - { id: 5, class: gpr32, preferred-register: '' }86 - { id: 6, class: gpr32, preferred-register: '' }87 - { id: 7, class: gpr32, preferred-register: '' }88 - { id: 8, class: gpr32, preferred-register: '' }89liveins:90 - { reg: '$a0', virtual-reg: '%0' }91 - { reg: '$a1', virtual-reg: '%1' }92 - { reg: '$a2', virtual-reg: '%2' }93body: |94 bb.0.entry:95 liveins: $a0, $a1, $a296 97 DBG_VALUE $a0, $noreg, !12, !DIExpression(), debug-location !1698 DBG_VALUE $a1, $noreg, !13, !DIExpression(), debug-location !1699 DBG_VALUE $a2, $noreg, !14, !DIExpression(), debug-location !16100 %2:gpr32 = COPY $a2101 DBG_VALUE %2, $noreg, !14, !DIExpression(), debug-location !16102 %8:gpr32 = COPY $a1103 DBG_VALUE %8, $noreg, !13, !DIExpression(), debug-location !16104 %0:gpr32 = COPY $a0105 DBG_VALUE %0, $noreg, !12, !DIExpression(), debug-location !16106 %3:gpr32 = nsw ADDu %8, %0, debug-location !17107 ADJCALLSTACKDOWN 16, 0, implicit-def dead $sp, implicit $sp, debug-location !19108 %4:gpr32 = nsw ADDiu %8, 10, debug-location !18109 $a0 = COPY %3, debug-location !19110 $a1 = COPY %2, debug-location !19111 DBG_VALUE $a1, $noreg, !14, !DIExpression(), debug-location !16112 $a2 = COPY %4, debug-location !19113 JAL @fn1, csr_o32, implicit-def dead $ra, implicit $a0, implicit $a1, implicit $a2, implicit-def $sp, implicit-def $v0, debug-location !19114 ADJCALLSTACKUP 16, 0, implicit-def dead $sp, implicit $sp, debug-location !19115 %5:gpr32 = COPY killed $v0, debug-location !19116 DBG_VALUE %5, $noreg, !15, !DIExpression(), debug-location !16117 %6:gpr32 = SLTi %5, 11, debug-location !22118 %7:gpr32 = nsw ADDiu %5, 10, debug-location !22119 %8:gpr32 = MOVZ_I_I %7, %6, %8, debug-location !22120 $v0 = COPY %8, debug-location !23121 RetRA implicit killed $v0, debug-location !23122 123...124