1; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s | FileCheck %s 2 3; Test that dbg.values of an SSA variable that's not used in a basic block, 4; is converted to a DBG_VALUE in that same basic block. We know that %1 is 5; live from the entry bb to the exit bb, is allocated a vreg because it's 6; used across basic blocks. We should be able to produce a DBG_VALUE that 7; refers to it in the nextbb block. 8 9source_filename = "debug.c" 10target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 11target triple = "x86_64-unknown-linux-gnu" 12 13; Function Attrs: nounwind uwtable 14define dso_local i32 @main(i32 %arg0, i32 %arg1) local_unnamed_addr !dbg !11 { 15entry: 16 %0 = add i32 %arg0, 42, !dbg !26 17 %1 = add i32 %arg1, 101, !dbg !26 18 %cmp = icmp eq i32 %1, 0 19 br i1 %cmp, label %nextbb, label %exit, !dbg !26 20 21nextbb: 22; CHECK-LABEL: bb.{{.*}}.nextbb 23 %2 = mul i32 %0, %arg1, !dbg !26 24; CHECK: IMUL32rr 25 call void @llvm.dbg.value(metadata i32 %1, metadata !16, metadata !DIExpression()), !dbg !27 26; CHECK-NEXT: DBG_VALUE 27 br label %exit, !dbg !26 28 29; CHECK-LABEL: bb.{{.*}}.exit 30exit: 31 %3 = phi i32 [ 12, %entry ], [ %2, %nextbb ], !dbg !26 32 %4 = add i32 %1, %3, !dbg !26 33 ret i32 %4, !dbg !26 34} 35 36declare void @llvm.dbg.value(metadata, metadata, metadata) 37 38!llvm.dbg.cu = !{!2} 39!llvm.module.flags = !{!7, !8, !9} 40!llvm.ident = !{!10} 41 42!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 7.0.0 (x)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4) 43!3 = !DIFile(filename: "debug.c", directory: "") 44!4 = !{} 45!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 46!7 = !{i32 2, !"Dwarf Version", i32 4} 47!8 = !{i32 2, !"Debug Info Version", i32 3} 48!9 = !{i32 1, !"wchar_size", i32 4} 49!10 = !{!"clang version 7.0.0 (x)"} 50!11 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !2, retainedNodes: !14) 51!12 = !DISubroutineType(types: !13) 52!13 = !{!6} 53!14 = !{!16} 54!16 = !DILocalVariable(name: "y", scope: !11, file: !3, line: 5, type: !6) 55!26 = !DILocation(line: 4, column: 7, scope: !11) 56!27 = !DILocation(line: 5, column: 7, scope: !11) 57!31 = !{!32, !32, i64 0} 58!32 = !{!"int", !33, i64 0} 59!33 = !{!"omnipotent char", !34, i64 0} 60!34 = !{!"Simple C/C++ TBAA"} 61