180 lines · plain
1# RUN: llc -start-before=prologepilog -stop-after=livedebugvalues -mattr=+sve -o - %s | FileCheck %s2#3# FIXME: re-enable this run line when InstrRef LiveDebugValues is able to4# rely on the target spill/restore inst recognisers.5# run: llc -start-before=prologepilog -stop-after=livedebugvalues -experimental-debug-variable-locations -mattr=+sve -o - %s | FileCheck %s6#7# Test that the LiveDebugValues pass can correctly handle the address8# of the SVE spill (at a scalable address location) which is expressed9# with a complex DIExpression.10#11# CHECK: $z2 = ORR_ZZZ killed $z1, $z112# CHECK: $z1 = ORR_ZZZ killed $z0, $z013# CHECK-DAG: ST1W_IMM renamable $z1, killed renamable $p{{[0-9]+}}, $fp, -[[#%u,OFFSET:]], debug-location !{{[0-9]+}} :: (store unknown-size into %stack.0, align 16)14# CHECK-DAG: DBG_VALUE $fp, 0, !{{[0-9]+}}, !DIExpression(DW_OP_constu, [[#mul(OFFSET,8)]], DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_minus),15#16# TODO: When LiveDebugValues pass supports reloads for AArch64, it should17# correctly recognize debug-value !27 is in $z1 after the following reload:18#19# CHECK: renamable $z1 = LD1W_IMM renamable $p0, $fp, -[[#OFFSET]], debug-location !34 :: (load unknown-size from %stack.0, align 16)20# CHECK-DAG: ST1W_IMM killed renamable $z3, killed renamable $p0, $fp, -[[#OFFSET]] :: (store unknown-size into %stack.0, align 16)21# CHECK-DAG: DBG_VALUE $noreg, $noreg, !27, !DIExpression(), debug-location !3022 23--- |24 ; ModuleID = 't.c'25 source_filename = "t.c"26 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"27 target triple = "aarch64-unknown-linux-gnu"28 29 ; Function Attrs: nounwind30 define dso_local <vscale x 8 x i32> @foo(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z1, i32 %c) local_unnamed_addr #0 !dbg !11 {31 entry:32 call void @llvm.dbg.value(metadata <vscale x 4 x i32> %z0, metadata !27, metadata !DIExpression()), !dbg !3033 call void @llvm.dbg.value(metadata <vscale x 4 x i32> %z1, metadata !28, metadata !DIExpression()), !dbg !3034 call void @llvm.dbg.value(metadata i32 %c, metadata !29, metadata !DIExpression()), !dbg !3035 %tobool.not = icmp eq i32 %c, 0, !dbg !3136 br i1 %tobool.not, label %if.end, label %if.then, !dbg !3337 38 if.then: ; preds = %entry39 %call = call <vscale x 8 x i32> @bar(<vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0, <vscale x 4 x i32> %z0) #0, !dbg !3440 br label %return, !dbg !3541 42 if.end: ; preds = %entry43 %0 = call <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32> %z1, <vscale x 4 x i32> %z0), !dbg !3644 br label %return, !dbg !3745 46 return: ; preds = %if.end, %if.then47 %retval.0 = phi <vscale x 8 x i32> [ %call, %if.then ], [ %0, %if.end ], !dbg !3048 ret <vscale x 8 x i32> %retval.0, !dbg !3849 }50 51 declare !dbg !39 dso_local <vscale x 8 x i32> @bar(<vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>, <vscale x 4 x i32>) local_unnamed_addr52 53 ; Function Attrs: nounwind readonly54 declare <vscale x 8 x i32> @llvm.aarch64.sve.tuple.create2.nxv8i32.nxv4i32(<vscale x 4 x i32>, <vscale x 4 x i32>)55 56 ; Function Attrs: nounwind readnone speculatable willreturn57 declare void @llvm.dbg.value(metadata, metadata, metadata) #158 59 attributes #0 = { "frame-pointer"="non-leaf"}60 attributes #1 = { readnone speculatable willreturn }61 62 !llvm.dbg.cu = !{!0}63 !llvm.module.flags = !{!3, !4, !5, !6, !7, !8, !9}64 !llvm.ident = !{!10}65 66 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git b19275ba870a06c5ef0428af6264ffd28c7cde9e)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)67 !1 = !DIFile(filename: "t.c", directory: "/tmp/")68 !2 = !{}69 !3 = !{i32 7, !"Dwarf Version", i32 4}70 !4 = !{i32 2, !"Debug Info Version", i32 3}71 !5 = !{i32 1, !"wchar_size", i32 4}72 !6 = !{i32 8, !"branch-target-enforcement", i32 0}73 !7 = !{i32 8, !"sign-return-address", i32 0}74 !8 = !{i32 8, !"sign-return-address-all", i32 0}75 !9 = !{i32 8, !"sign-return-address-with-bkey", i32 0}76 !10 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git b19275ba870a06c5ef0428af6264ffd28c7cde9e)"}77 !11 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 6, type: !12, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !26)78 !12 = !DISubroutineType(types: !13)79 !13 = !{!14, !21, !21, !18}80 !14 = !DIDerivedType(tag: DW_TAG_typedef, name: "svint32x2_t", file: !15, line: 59, baseType: !16)81 !15 = !DIFile(filename: "lib/clang/12.0.0/include/arm_sve.h", directory: "/tmp")82 !16 = !DIDerivedType(tag: DW_TAG_typedef, name: "__clang_svint32x2_t", file: !1, baseType: !17)83 !17 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, flags: DIFlagVector, elements: !19)84 !18 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)85 !19 = !{!20}86 !20 = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_constu, 4, DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_constu, 1, DW_OP_minus))87 !21 = !DIDerivedType(tag: DW_TAG_typedef, name: "svint32_t", file: !15, line: 34, baseType: !22)88 !22 = !DIDerivedType(tag: DW_TAG_typedef, name: "__SVInt32_t", file: !1, baseType: !23)89 !23 = !DICompositeType(tag: DW_TAG_array_type, baseType: !18, flags: DIFlagVector, elements: !24)90 !24 = !{!25}91 !25 = !DISubrange(lowerBound: 0, upperBound: !DIExpression(DW_OP_constu, 2, DW_OP_bregx, 46, 0, DW_OP_mul, DW_OP_constu, 1, DW_OP_minus))92 !26 = !{!27, !28, !29}93 !27 = !DILocalVariable(name: "z0", arg: 1, scope: !11, file: !1, line: 6, type: !21)94 !28 = !DILocalVariable(name: "z1", arg: 2, scope: !11, file: !1, line: 6, type: !21)95 !29 = !DILocalVariable(name: "c", arg: 3, scope: !11, file: !1, line: 6, type: !18)96 !30 = !DILocation(line: 0, scope: !11)97 !31 = !DILocation(line: 7, column: 7, scope: !32)98 !32 = distinct !DILexicalBlock(scope: !11, file: !1, line: 7, column: 7)99 !33 = !DILocation(line: 7, column: 7, scope: !11)100 !34 = !DILocation(line: 8, column: 12, scope: !32)101 !35 = !DILocation(line: 8, column: 5, scope: !32)102 !36 = !DILocation(line: 9, column: 10, scope: !11)103 !37 = !DILocation(line: 9, column: 3, scope: !11)104 !38 = !DILocation(line: 10, column: 1, scope: !11)105 !39 = !DISubprogram(name: "bar", scope: !1, file: !1, line: 3, type: !40, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)106 !40 = !DISubroutineType(types: !41)107 !41 = !{!17, !23, !23, !23, !23, !23, !23, !23, !23, !23}108 109...110---111name: foo112alignment: 4113tracksRegLiveness: true114liveins:115 - { reg: '$z0' }116 - { reg: '$z1' }117 - { reg: '$w0' }118frameInfo:119 maxAlignment: 16120 adjustsStack: true121 hasCalls: true122 maxCallFrameSize: 0123 savePoint:124 - point: '%bb.1'125 restorePoint:126 - point: '%bb.1'127stack:128 - { id: 0, size: 16, alignment: 16, stack-id: scalable-vector }129machineFunctionInfo: {}130body: |131 bb.0.entry:132 successors: %bb.2(0x30000000), %bb.1(0x50000000)133 liveins: $w0, $z0, $z1134 135 DBG_VALUE $z0, $noreg, !27, !DIExpression(), debug-location !30136 DBG_VALUE $z1, $noreg, !28, !DIExpression(), debug-location !30137 DBG_VALUE $w0, $noreg, !29, !DIExpression(), debug-location !30138 renamable $z2 = COPY $z1139 renamable $z1 = COPY $z0140 DBG_VALUE $w0, $noreg, !29, !DIExpression(), debug-location !30141 DBG_VALUE $z2, $noreg, !28, !DIExpression(), debug-location !30142 DBG_VALUE $z1, $noreg, !27, !DIExpression(), debug-location !30143 CBZW killed renamable $w0, %bb.2, debug-location !33144 B %bb.1, debug-location !33145 146 bb.1.if.then:147 liveins: $z1148 149 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp, debug-location !34150 renamable $p0 = PTRUE_S 31, implicit $vg, debug-location !34151 $x0 = ADDXri %stack.0, 0, 0, debug-location !34152 ST1W_IMM renamable $z1, killed renamable $p0, %stack.0, 0, debug-location !34 :: (store unknown-size into %stack.0, align 16)153 $z0 = COPY renamable $z1, debug-location !34154 $z2 = COPY renamable $z1, debug-location !34155 $z3 = COPY renamable $z1, debug-location !34156 $z4 = COPY renamable $z1, debug-location !34157 $z5 = COPY renamable $z1, debug-location !34158 $z6 = COPY renamable $z1, debug-location !34159 $z7 = COPY renamable $z1, debug-location !34160 BL @bar, csr_aarch64_sve_aapcs, implicit-def dead $lr, implicit $sp, implicit $z0, implicit $z1, implicit $z2, implicit $z3, implicit $z4, implicit $z5, implicit $z6, implicit $z7, implicit $x0, implicit-def $sp, implicit-def $z0, implicit-def $z1, debug-location !34161 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp, debug-location !34162 renamable $p0 = PTRUE_S 31, implicit $vg, debug-location !34163 $z3 = IMPLICIT_DEF164 renamable $z1 = LD1W_IMM renamable $p0, %stack.0, 0, debug-location !34 :: (load unknown-size from %stack.0, align 16)165 ST1W_IMM renamable $z3, killed renamable $p0, %stack.0, 0 :: (store unknown-size into %stack.0, align 16)166 renamable $z2 = COPY $z0, debug-location !34167 B %bb.3, debug-location !35168 169 bb.2.if.end:170 liveins: $z1, $z2171 172 173 bb.3.return:174 liveins: $z1, $z2175 176 $z0 = COPY killed renamable $z2, debug-location !38177 RET_ReallyLR implicit $z0, implicit $z1, debug-location !38178 179...180