189 lines · plain
1# Test to ensure that variable "__last" is properly recovered at the end of the livedebugvalues pass when Instruction Referencing-based LiveDebugValues is used.2# This testcase was obtained by looking at FileCheck.cpp and reducing it down via llvm-reduce.3# This test is the same as llvm/test/DebugInfo/AArch64/instr-ref-target-hooks.ll, however, the output is taken just before the livedebugvalues pass, and then a clobber4# to the stack slot has been added after the first LDRXui in bb.2.if.then13, the livedebugvalues pass should still recover the value, as it was loaded into $x8 before the clobber.5 6# RUN: llc -o - %s -start-before=livedebugvalues -stop-after=livedebugvalues -mtriple=aarch64-apple-darwin | FileCheck %s7 8# CHECK: ![[LOC:[0-9]+]] = !DILocalVariable(name: "__last",9# CHECK-LABEL: bb.2.if.then1310# CHECK: STRXui $xzr, $sp, 111# CHECK-NEXT: DBG_VALUE_LIST ![[LOC]], !DIExpression(DW_OP_LLVM_arg, 0), $x812 13--- |14 ; ModuleID = '/Users/srastogi/Development/llvm-project/llvm/test/DebugInfo/AArch64/instr-ref-target-hooks.ll'15 source_filename = "/Users/srastogi/Development/llvm-project/llvm/test/DebugInfo/AArch64/instr-ref-target-hooks.ll"16 target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-n32:64-S128-Fn32"17 18 declare void @_ZdlPvm()19 20 define fastcc void @"_ZNSt3__111__introsortINS_17_ClassicAlgPolicyERZL18DumpAnnotatedInputRN4llvm11raw_ostreamERKNS2_16FileCheckRequestE20DumpInputFilterValuejNS2_9StringRefERNS_6vectorI15InputAnnotationNS_9allocatorISB_EEEEjE3$_0PSB_Lb0EEEvT1_SJ_T0_NS_15iterator_traitsISJ_E15difference_typeEb"(ptr %__first, ptr %__last, i1 %cmp, ptr %__first.addr.0, ptr %Label3.i.i.i241, ptr %__pivot.sroa.9113.8.copyload.i, ptr %0, ptr %1) !dbg !4 {21 br label %while.cond22 23 while.cond: ; preds = %if.end16, %224 br i1 %cmp, label %if.then13, label %if.end1625 26 if.then13: ; preds = %while.cond27 %cmp.i = icmp eq ptr %__first, %__last28 %or.cond.i = select i1 %cmp.i, i1 false, i1 false29 #dbg_value(ptr %__last, !10, !DIExpression(), !16)30 br i1 %or.cond.i, label %common.ret, label %for.body.i, !dbg !2031 32 common.ret: ; preds = %for.body.i, %if.then1333 ret void34 35 for.body.i: ; preds = %if.then1336 %InputLine.i.i = getelementptr i8, ptr %__first.addr.0, i64 13237 br label %common.ret38 39 if.end16: ; preds = %while.cond40 %__pivot.sroa.13.8.copyload.i = load i64, ptr null, align 841 call void @_ZdlPvm()42 store ptr %__pivot.sroa.9113.8.copyload.i, ptr %0, align 843 store i64 %__pivot.sroa.13.8.copyload.i, ptr %1, align 844 store i64 0, ptr %__first, align 845 store i32 0, ptr %__first.addr.0, align 846 store i32 1, ptr %Label3.i.i.i241, align 447 br label %while.cond48 }49 50 !llvm.module.flags = !{!0}51 !llvm.dbg.cu = !{!1}52 53 !0 = !{i32 2, !"Debug Info Version", i32 3}54 !1 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !2, producer: "clang version 22.0.0git (git@github.com:llvm/llvm-project.git 46a3b4d5dc6dd9449ec7c0c9065552368cdf41d6)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, retainedTypes: !3, globals: !3, imports: !3, splitDebugInlining: false, nameTableKind: Apple, sysroot: "/Library/Developer/CommandLineTools/SDKs/MacOSX15.3.sdk", sdk: "MacOSX15.3.sdk")55 !2 = !DIFile(filename: "/Users/shubhamrastogi/Development/llvm-project-instr-ref/llvm-project/llvm/utils/FileCheck/FileCheck.cpp", directory: "/Users/shubhamrastogi/Development/llvm-project-instr-ref/llvm-project/build-instr-ref-stage2", checksumkind: CSK_MD5, checksum: "fa5f53f1b5782eb8b92fadec416b8941")56 !3 = !{}57 !4 = distinct !DISubprogram(name: "__introsort<std::__1::_ClassicAlgPolicy, (lambda at /Users/shubhamrastogi/Development/llvm-project-instr-ref/llvm-project/llvm/utils/FileCheck/FileCheck.cpp:544:14) &, InputAnnotation *, false>", linkageName: "_ZNSt3__111__introsortINS_17_ClassicAlgPolicyERZL18DumpAnnotatedInputRN4llvm11raw_ostreamERKNS2_16FileCheckRequestE20DumpInputFilterValuejNS2_9StringRefERNS_6vectorI15InputAnnotationNS_9allocatorISB_EEEEjE3$_0PSB_Lb0EEEvT1_SJ_T0_NS_15iterator_traitsISJ_E15difference_typeEb", scope: !6, file: !5, line: 758, type: !8, scopeLine: 762, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !1, templateParams: !3, retainedNodes: !3, keyInstructions: true)58 !5 = !DIFile(filename: "/Library/Developer/CommandLineTools/SDKs/MacOSX15.3.sdk/usr/include/c++/v1/__algorithm/sort.h", directory: "")59 !6 = !DINamespace(name: "__1", scope: !7, exportSymbols: true)60 !7 = !DINamespace(name: "std", scope: null)61 !8 = !DISubroutineType(cc: DW_CC_nocall, types: !9)62 !9 = !{null}63 !10 = !DILocalVariable(name: "__last", arg: 2, scope: !11, file: !5, line: 284, type: !13)64 !11 = distinct !DISubprogram(name: "__insertion_sort<std::__1::_ClassicAlgPolicy, (lambda at /Users/shubhamrastogi/Development/llvm-project-instr-ref/llvm-project/llvm/utils/FileCheck/FileCheck.cpp:544:14) &, InputAnnotation *>", linkageName: "_ZNSt3__116__insertion_sortB8nn180100INS_17_ClassicAlgPolicyERZL18DumpAnnotatedInputRN4llvm11raw_ostreamERKNS2_16FileCheckRequestE20DumpInputFilterValuejNS2_9StringRefERNS_6vectorI15InputAnnotationNS_9allocatorISB_EEEEjE3$_0PSB_EEvT1_SJ_T0_", scope: !6, file: !5, line: 284, type: !12, scopeLine: 284, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !1, templateParams: !3, retainedNodes: !3, keyInstructions: true)65 !12 = distinct !DISubroutineType(types: !9)66 !13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64)67 !14 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "InputAnnotation", file: !15, line: 323, size: 768, flags: DIFlagTypePassByReference | DIFlagNonTrivial, elements: !3, identifier: "_ZTS15InputAnnotation")68 !15 = !DIFile(filename: "llvm/utils/FileCheck/FileCheck.cpp", directory: "/Users/shubhamrastogi/Development/llvm-project-instr-ref/llvm-project", checksumkind: CSK_MD5, checksum: "fa5f53f1b5782eb8b92fadec416b8941")69 !16 = !DILocation(line: 0, scope: !11, inlinedAt: !17)70 !17 = distinct !DILocation(line: 800, column: 9, scope: !18)71 !18 = distinct !DILexicalBlock(scope: !19, file: !5, line: 799, column: 23)72 !19 = distinct !DILexicalBlock(scope: !4, file: !5, line: 770, column: 16)73 !20 = !DILocation(line: 288, column: 15, scope: !21, inlinedAt: !17, atomGroup: 1, atomRank: 1)74 !21 = distinct !DILexicalBlock(scope: !11, file: !5, line: 288, column: 7)75...76---77name: '_ZNSt3__111__introsortINS_17_ClassicAlgPolicyERZL18DumpAnnotatedInputRN4llvm11raw_ostreamERKNS2_16FileCheckRequestE20DumpInputFilterValuejNS2_9StringRefERNS_6vectorI15InputAnnotationNS_9allocatorISB_EEEEjE3$_0PSB_Lb0EEEvT1_SJ_T0_NS_15iterator_traitsISJ_E15difference_typeEb'78alignment: 479tracksRegLiveness: true80noPhis: true81isSSA: false82noVRegs: true83hasFakeUses: false84debugInstrRef: true85tracksDebugUserValues: true86liveins:87 - { reg: '$x0' }88 - { reg: '$x1' }89 - { reg: '$w2' }90 - { reg: '$x3' }91 - { reg: '$x4' }92 - { reg: '$x5' }93 - { reg: '$x6' }94 - { reg: '$x7' }95frameInfo:96 stackSize: 11297 maxAlignment: 898 adjustsStack: true99 hasCalls: true100 maxCallFrameSize: 0101 isCalleeSavedInfoValid: true102stack:103 - { id: 0, type: spill-slot, offset: -104, size: 8, alignment: 8 }104 - { id: 1, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' }105 - { id: 2, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' }106 - { id: 3, type: spill-slot, offset: -24, size: 8, alignment: 8, callee-saved-register: '$x19' }107 - { id: 4, type: spill-slot, offset: -32, size: 8, alignment: 8, callee-saved-register: '$x20' }108 - { id: 5, type: spill-slot, offset: -40, size: 8, alignment: 8, callee-saved-register: '$x21' }109 - { id: 6, type: spill-slot, offset: -48, size: 8, alignment: 8, callee-saved-register: '$x22' }110 - { id: 7, type: spill-slot, offset: -56, size: 8, alignment: 8, callee-saved-register: '$x23' }111 - { id: 8, type: spill-slot, offset: -64, size: 8, alignment: 8, callee-saved-register: '$x24' }112 - { id: 9, type: spill-slot, offset: -72, size: 8, alignment: 8, callee-saved-register: '$x25' }113 - { id: 10, type: spill-slot, offset: -80, size: 8, alignment: 8, callee-saved-register: '$x26' }114 - { id: 11, type: spill-slot, offset: -88, size: 8, alignment: 8, callee-saved-register: '$x27' }115 - { id: 12, type: spill-slot, offset: -96, size: 8, alignment: 8, callee-saved-register: '$x28' }116machineFunctionInfo:117 hasRedZone: false118 stackSizeZPR: 0119 stackSizePPR: 0120 hasStackFrame: true121body: |122 bb.0 (%ir-block.2):123 successors: %bb.2(0x04000000), %bb.3(0x7c000000)124 liveins: $w2, $x0, $x1, $x3, $x4, $x5, $x6, $x7, $x27, $x28, $x25, $x26, $x23, $x24, $x21, $x22, $x19, $x20, $lr125 126 $sp = frame-setup SUBXri $sp, 112, 0127 frame-setup STPXi killed $x28, killed $x27, $sp, 2 :: (store (s64) into %stack.12), (store (s64) into %stack.11)128 frame-setup STPXi killed $x26, killed $x25, $sp, 4 :: (store (s64) into %stack.10), (store (s64) into %stack.9)129 frame-setup STPXi killed $x24, killed $x23, $sp, 6 :: (store (s64) into %stack.8), (store (s64) into %stack.7)130 frame-setup STPXi killed $x22, killed $x21, $sp, 8 :: (store (s64) into %stack.6), (store (s64) into %stack.5)131 frame-setup STPXi killed $x20, killed $x19, $sp, 10 :: (store (s64) into %stack.4), (store (s64) into %stack.3)132 frame-setup STPXi $fp, killed $lr, $sp, 12 :: (store (s64) into %stack.2), (store (s64) into %stack.1)133 frame-setup CFI_INSTRUCTION def_cfa_offset 112134 frame-setup CFI_INSTRUCTION offset $w30, -8135 frame-setup CFI_INSTRUCTION offset $w29, -16136 frame-setup CFI_INSTRUCTION offset $w19, -24137 frame-setup CFI_INSTRUCTION offset $w20, -32138 frame-setup CFI_INSTRUCTION offset $w21, -40139 frame-setup CFI_INSTRUCTION offset $w22, -48140 frame-setup CFI_INSTRUCTION offset $w23, -56141 frame-setup CFI_INSTRUCTION offset $w24, -64142 frame-setup CFI_INSTRUCTION offset $w25, -72143 frame-setup CFI_INSTRUCTION offset $w26, -80144 frame-setup CFI_INSTRUCTION offset $w27, -88145 frame-setup CFI_INSTRUCTION offset $w28, -96146 DBG_PHI $x1, 1147 $x19 = ORRXrs $xzr, killed $x7, 0148 $x20 = ORRXrs $xzr, killed $x6, 0149 $x21 = ORRXrs $xzr, killed $x5, 0150 $x22 = ORRXrs $xzr, killed $x4, 0151 $x23 = ORRXrs $xzr, killed $x3, 0152 $w25 = ORRWrs $wzr, killed $w2, 0153 $x26 = ORRXrs $xzr, killed $x0, 0154 renamable $w27 = MOVZWi 1, 0155 STRXui killed $x1, $sp, 1 :: (store (s64) into %stack.0)156 TBNZW renamable $w25, 0, %bb.2157 158 bb.3.if.end16:159 successors: %bb.2(0x04000000), %bb.3(0x7c000000)160 liveins: $w25, $w27, $x19, $x20, $x21, $x22, $x23, $x26161 162 $x28 = ORRXrs $xzr, $xzr, 0163 renamable $x24 = LDRXui killed renamable $x28, 0 :: (load (s64) from `ptr null`)164 BL @_ZdlPvm, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit-def $sp165 STRXui renamable $x21, renamable $x20, 0 :: (store (s64) into %ir.0)166 STRXui killed renamable $x24, renamable $x19, 0 :: (store (s64) into %ir.1)167 STRXui $xzr, renamable $x26, 0 :: (store (s64) into %ir.__first)168 STRWui $wzr, renamable $x23, 0 :: (store (s32) into %ir.__first.addr.0, align 8)169 STRWui renamable $w27, renamable $x22, 0 :: (store (s32) into %ir.Label3.i.i.i241)170 TBZW renamable $w25, 0, %bb.3171 172 bb.2.if.then13:173 liveins: $x26174 175 DBG_INSTR_REF !10, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(1, 0), debug-location !16176 renamable $x8 = LDRXui $sp, 1 :: (load (s64) from %stack.0)177 ; Clobber the stack slot that contains the value we care about, to ensure that LDV can still recover it from $x8 above178 STRXui $xzr, $sp, 1 :: (store (s64) into %stack.0)179 $fp, $lr = frame-destroy LDPXi $sp, 12 :: (load (s64) from %stack.2), (load (s64) from %stack.1)180 $x20, $x19 = frame-destroy LDPXi $sp, 10 :: (load (s64) from %stack.4), (load (s64) from %stack.3)181 $xzr = SUBSXrs killed renamable $x26, killed renamable $x8, 0, implicit-def $nzcv, debug-location !20182 $x22, $x21 = frame-destroy LDPXi $sp, 8 :: (load (s64) from %stack.6), (load (s64) from %stack.5)183 $x24, $x23 = frame-destroy LDPXi $sp, 6 :: (load (s64) from %stack.8), (load (s64) from %stack.7)184 $x26, $x25 = frame-destroy LDPXi $sp, 4 :: (load (s64) from %stack.10), (load (s64) from %stack.9)185 $x28, $x27 = frame-destroy LDPXi $sp, 2 :: (load (s64) from %stack.12), (load (s64) from %stack.11)186 $sp = frame-destroy ADDXri $sp, 112, 0187 RET undef $lr188...189