1; RUN: llc %s -stop-after=finalize-isel -o - \ 2; RUN: | FileCheck %s 3 4 5; RUN: llc --try-experimental-debuginfo-iterators %s -stop-after=finalize-isel -o - \ 6; RUN: | FileCheck %s 7 8;; Hand written test because the scenario is unlikely. Check that the "value" 9;; of a debug def PHIs is "undef" (because we don't actually track PHIs). 10;; 11;; entry: 12;; memdef 5, !1 13;; dbgdef !1 14;; br if.then, exit 15;; 16;; if.then: 17;; memdef 0, !1 18;; dbgdef !1 19;; br exit 20;; 21;; exit: 22;; ; <-- Dbg=!1, Stack=!1, Loc=Mem 23;; memddef 1, !2 ; <-- Dbg=!1, Stack=!2, Loc=Val(undef) @HERE 24;; call 25;; dbgdef !2 26;; 27;; Check that the dbg.value inserted at @HERE is undef because there's no 28;; appropriate alternative value to choose. 29 30; CHECK: bb.0.entry: 31; CHECK: DBG_VALUE %stack.0.c, $noreg, ![[var:[0-9]+]], !DIExpression(DW_OP_deref), debug-location 32; CHECK-NEXT: MOV8mi %stack.0.c, 1, $noreg, 0, $noreg, 5, debug-location 33; CHECL-NEXT: DBG_VALUE %stack.0.c, $noreg, ![[var]], !DIExpression(DW_OP_deref), debug-location 34 35; CHECK: bb.1.if.then: 36; CHECK: MOV8mi %stack.0.c, 1, $noreg, 0, $noreg, 0 37; CHECK: DBG_VALUE %stack.0.c, $noreg, ![[var]], !DIExpression(DW_OP_deref), debug-location 38 39; CHECK: bb.2.exit: 40; CHECK-NEXT: MOV8mi %stack.0.c, 1, $noreg, 0, $noreg, 1 41;; @HERE 42; CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[var]], !DIExpression() 43; CHECK: CALL64pcrel32 @d 44; CHECK-NEXT: ADJCALLSTACKUP64 45; CHECK-NEXT: DBG_VALUE %stack.0.c, $noreg, ![[var]], !DIExpression(DW_OP_deref), debug-location 46 47target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 48target triple = "x86_64-unknown-linux-gnu" 49 50; Function Attrs: nounwind uwtable 51define dso_local void @b(i1 %cond) local_unnamed_addr #0 !dbg !7 { 52entry: 53 %c = alloca i8, align 1, !DIAssignID !13 54 call void @llvm.dbg.assign(metadata i1 undef, metadata !11, metadata !DIExpression(), metadata !13, metadata ptr %c, metadata !DIExpression()), !dbg !14 55 store i8 5, ptr %c, align 1, !dbg !16, !DIAssignID !31 56 call void @llvm.dbg.assign(metadata i8 5, metadata !11, metadata !DIExpression(), metadata !31, metadata ptr %c, metadata !DIExpression()), !dbg !14 57 br i1 %cond, label %if.then, label %exit 58 59if.then: 60 tail call void (...) @d() #4, !dbg !21 61 store i8 0, ptr %c, align 1, !dbg !16, !DIAssignID !31 62 call void @llvm.dbg.assign(metadata i8 0, metadata !11, metadata !DIExpression(), metadata !31, metadata ptr %c, metadata !DIExpression()), !dbg !14 63 br label %exit 64 65exit: 66 store i8 1, ptr %c, align 1, !dbg !16, !DIAssignID !20 67 tail call void (...) @d() #4, !dbg !21 68 call void @llvm.dbg.assign(metadata i8 1, metadata !11, metadata !DIExpression(), metadata !20, metadata ptr %c, metadata !DIExpression()), !dbg !14 69 call void @a(ptr nonnull %c) #4, !dbg !22 70 ret void, !dbg !23 71} 72 73 74declare !dbg !24 dso_local void @d(...) local_unnamed_addr #2 75declare !dbg !27 dso_local void @a(ptr) local_unnamed_addr #2 76declare void @llvm.dbg.assign(metadata, metadata, metadata, metadata, metadata, metadata) #3 77 78!llvm.dbg.cu = !{!0} 79!llvm.module.flags = !{!3, !4, !5, !1000} 80!llvm.ident = !{!6} 81 82!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) 83!1 = !DIFile(filename: "reduce.c", directory: "/") 84!2 = !{} 85!3 = !{i32 7, !"Dwarf Version", i32 4} 86!4 = !{i32 2, !"Debug Info Version", i32 3} 87!5 = !{i32 1, !"wchar_size", i32 4} 88!6 = !{!"clang version 12.0.0"} 89!7 = distinct !DISubprogram(name: "b", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !10) 90!8 = !DISubroutineType(types: !9) 91!9 = !{null} 92!10 = !{!11} 93!11 = !DILocalVariable(name: "c", scope: !7, file: !1, line: 4, type: !12) 94!12 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 95!13 = distinct !DIAssignID() 96!14 = !DILocation(line: 0, scope: !7) 97!15 = !DILocation(line: 4, column: 3, scope: !7) 98!16 = !DILocation(line: 4, column: 8, scope: !7) 99!20 = distinct !DIAssignID() 100!21 = !DILocation(line: 5, column: 3, scope: !7) 101!22 = !DILocation(line: 6, column: 3, scope: !7) 102!23 = !DILocation(line: 7, column: 1, scope: !7) 103!24 = !DISubprogram(name: "d", scope: !1, file: !1, line: 2, type: !25, spFlags: DISPFlagOptimized, retainedNodes: !2) 104!25 = !DISubroutineType(types: !26) 105!26 = !{null, null} 106!27 = !DISubprogram(name: "a", scope: !1, file: !1, line: 1, type: !28, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 107!28 = !DISubroutineType(types: !29) 108!29 = !{null, !30} 109!30 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 64) 110!31 = distinct !DIAssignID() 111!1000 = !{i32 7, !"debug-info-assignment-tracking", i1 true} 112