84 lines · plain
1# RUN: llc --run-pass=livedebugvalues -o - %s | FileCheck %s --implicit-check-not=DBG_VALUE 2# REQUIRES: aarch64-registered-target3 4# This test covers the scenario where a DBG_VALUE created prior to LiveDebugValues has an entry-value expression.5# It ensures that a clobbered stack copy doesn't crash if used as an entry-value because entry-values can't be clobbered.6 7--- |8 target triple = "aarch64-"9 define i32 @baz(i32 swiftasync %arg1, i32 noundef %arg2, i1 %cond) !dbg !4 {10 br i1 %cond, label %if.then, label %if.else, !dbg !1411 if.then: ; preds = %012 %call = call i32 @foo(i32 noundef %arg1), !dbg !1513 br label %if.end, !dbg !1814 if.else: ; preds = %015 %call1 = call i32 @foo(i32 noundef %arg2), !dbg !1916 br label %if.end17 if.end: ; preds = %if.else, %if.then18 %temp.0 = phi i32 [ %call, %if.then ], [ %call1, %if.else ], !dbg !2119 ret i32 %temp.0, !dbg !2220 }21 declare i32 @foo(i32)22 !llvm.dbg.cu = !{!0}23 !llvm.module.flags = !{!2, !3}24 !0 = distinct !DICompileUnit(language: DW_LANG_C11, file: !1, producer: "ha", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)25 !1 = !DIFile(filename: "test.c", directory: "hah")26 !2 = !{i32 7, !"Dwarf Version", i32 4}27 !3 = !{i32 2, !"Debug Info Version", i32 3}28 !4 = distinct !DISubprogram(name: "baz", scope: !1, file: !1, line: 3, type: !5, scopeLine: 3, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !8)29 !5 = !DISubroutineType(types: !6)30 !6 = !{!7, !7, !7, !7}31 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)32 !8 = !{!9, !10, !11, !12}33 !9 = !DILocalVariable(name: "arg1", arg: 1, scope: !4, file: !1, line: 3, type: !7)34 !10 = !DILocalVariable(name: "arg2", arg: 2, scope: !4, file: !1, line: 3, type: !7)35 !11 = !DILocalVariable(name: "cond", arg: 3, scope: !4, file: !1, line: 3, type: !7)36 !12 = !DILocalVariable(name: "local", scope: !4, file: !1, line: 4, type: !7)37 !13 = !DILocation(line: 0, scope: !4)38 !14 = !DILocation(line: 7, column: 7, scope: !4)39 !15 = !DILocation(line: 8, column: 12, scope: !16)40 !16 = distinct !DILexicalBlock(scope: !17, file: !1, line: 7, column: 13)41 !17 = distinct !DILexicalBlock(scope: !4, file: !1, line: 7, column: 7)42 !18 = !DILocation(line: 9, column: 3, scope: !16)43 !19 = !DILocation(line: 10, column: 12, scope: !20)44 !20 = distinct !DILexicalBlock(scope: !17, file: !1, line: 9, column: 10)45 !21 = !DILocation(line: 0, scope: !17)46 !22 = !DILocation(line: 13, column: 3, scope: !4)47name: baz48debugInstrRef: true49stack:50 - { id: 1, name: '', type: spill-slot, offset: -24, size: 4, alignment: 4, 51 debug-info-variable: '', debug-info-expression: '', debug-info-location: '' }52body: |53 bb.0 (%ir-block.0):54 DBG_VALUE $w1, $noreg, !12, !DIExpression(DW_OP_LLVM_entry_value, 1), debug-location !1355 56 bb.1.if.then:57 $w0 = LDRWui $sp, 258 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $w0, debug-location !1559 $w1 = MOVi32imm 060 61 bb.2.if.else:62 $w0 = LDRWui $sp, 363 BL @foo, csr_darwin_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $w0, implicit-def $w0, debug-location !1964 STRWui killed $w0, $sp, 165 B %bb.366 67 bb.3.if.end:68 $w0 = LDRWui $sp, 169 $fp, $lr = frame-destroy LDPXi $sp, 2, debug-location !2270 $sp = frame-destroy ADDXri $sp, 32, 0, debug-location !2271 RET undef $lr, implicit killed $w0, debug-location !2272 73# CHECK-LABEL: bb.074# CHECK: DBG_VALUE $w1, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)75# CHECK-LABEL: bb.1.if.then:76# CHECK: DBG_VALUE $w1, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)77# CHECK-NEXT: $w0 = LDRWui $sp, 278# CHECK-NEXT: BL @foo79# CHECK-NEXT: $w1 = MOVi32imm 080# CHECK-NOT: DBG_VALUE $w1, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)81# CHECK-LABEL: bb.2.if.else:82# CHECK: DBG_VALUE $w1, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)83# CHECK-LABEL: bb.3.if.end:84# CHECK: DBG_VALUE $w1, {{.*}}, !DIExpression(DW_OP_LLVM_entry_value, 1)