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