73 lines · plain
1; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \2; RUN: -stop-before finalize-isel %s -o - \3; RUN: -experimental-debug-variable-locations=false \4; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE5 6; RUN: llc -mtriple=x86_64-unknown-unknown -start-after=codegenprepare \7; RUN: -stop-before finalize-isel %s -o - \8; RUN: -experimental-debug-variable-locations=true \9; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF10 11; Adapted from sdag-ir-salvage.ll to test dbg.assign intrinsics. This ensures12; that dbg.assigns with no linked store are treated as dbg.values.13 14; Test that the dbg.value for %baz, which doesn't exist in the 'next' bb,15; can be salvaged back to the underlying argument vreg.16 17; CHECK: ![[AAAVAR:.*]] = !DILocalVariable(name: "aaa",18; CHECK-LABEL: bb.0.entry:19; INSTRREF: DBG_PHI $rdi, 120; CHECK-LABEL: bb.1.next:21; INSTRREF: DBG_INSTR_REF ![[AAAVAR]], {{.+}}, dbg-instr-ref(1, 0)22; DBGVALUE: DBG_VALUE %{{[0-9]+}}, $noreg, ![[AAAVAR]]23 24target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"25target triple = "x86_64-linux-gnu"26 27define i8 @f(ptr %foo) local_unnamed_addr !dbg !6 {28entry:29 %bar = getelementptr i32, ptr %foo, i32 430 %baz = bitcast ptr %bar to ptr31 %quux = load i8, ptr %baz32 br label %next33 34next: ; preds = %entry35 tail call void @llvm.dbg.assign(metadata ptr %baz, metadata !15, metadata !DIExpression(), metadata !31, metadata ptr undef, metadata !DIExpression()), !dbg !3036 %xyzzy = add i8 %quux, 12337 br label %fin38 39fin: ; preds = %next40 %trains = getelementptr i32, ptr %foo, i32 341 %planes = bitcast ptr %trains to ptr42 %cars = load i8, ptr %planes43 %ret = add i8 %xyzzy, %cars44 ret i8 %ret45}46 47; Function Attrs: nounwind readnone speculatable48declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #049 50attributes #0 = { nounwind readnone speculatable }51 52!llvm.dbg.cu = !{!0}53!llvm.module.flags = !{!25, !26, !27, !28, !1000}54!llvm.ident = !{!29}55 56!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)57!1 = !DIFile(filename: "test.c", directory: ".")58!2 = !{}59!6 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 18, type: !7, scopeLine: 19, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)60!7 = !DISubroutineType(types: !8)61!8 = !{!13}62!13 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_unsigned)63!14 = !{!15}64!15 = !DILocalVariable(name: "aaa", scope: !6, file: !1, line: 18, type: !13)65!25 = !{i32 2, !"Dwarf Version", i32 4}66!26 = !{i32 2, !"Debug Info Version", i32 3}67!27 = !{i32 1, !"wchar_size", i32 4}68!28 = !{i32 7, !"PIC Level", i32 2}69!29 = !{!"clang"}70!30 = !DILocation(line: 18, column: 14, scope: !6)71!31 = distinct !DIAssignID()72!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true}73