1 ; RUN: llc < %s | FileCheck %s 2 ; Should sink matching DBG_VALUEs also. 3 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64" 4 target triple = "x86_64-apple-macosx10.7.0" 5 6 define i32 @foo(i32 %i, i32* nocapture %c) nounwind uwtable readonly ssp !dbg !1 { 7 tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !6, metadata !DIExpression()), !dbg !12 8 %ab = load i32, i32* %c, align 1, !dbg !14 9 tail call void @llvm.dbg.value(metadata i32* %c, i64 0, metadata !7, metadata !DIExpression()), !dbg !13 10 tail call void @llvm.dbg.value(metadata i32 %ab, i64 0, metadata !10, metadata !DIExpression()), !dbg !14 11 %cd = icmp eq i32 %i, 42, !dbg !15 12 br i1 %cd, label %bb1, label %bb2, !dbg !15 13 14 bb1: ; preds = %0 15 ;CHECK: DEBUG_VALUE: a 16 ;CHECK: .loc 1 5 5 17 ;CHECK-NEXT: addl 18 %gh = add nsw i32 %ab, 2, !dbg !16 19 br label %bb2, !dbg !16 20 21 bb2: 22 %.0 = phi i32 [ %gh, %bb1 ], [ 0, %0 ] 23 ret i32 %.0, !dbg !17 24 } 25 26 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone 27 28 !llvm.dbg.cu = !{!0} 29 !llvm.module.flags = !{!22} 30 31 !0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)", isOptimized: true, emissionKind: 1, file: !20, enums: !21, retainedTypes: !21, subprograms: !18, imports: null) 32 !1 = distinct !DISubprogram(name: "foo", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, file: !20, scope: !2, type: !3, variables: !19) 33 !2 = !DIFile(filename: "a.c", directory: "/private/tmp") 34 !3 = !DISubroutineType(types: !4) 35 !4 = !{!5} 36 !5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 37 !6 = !DILocalVariable(name: "i", line: 2, arg: 1, scope: !1, file: !2, type: !5) 38 !7 = !DILocalVariable(name: "c", line: 2, arg: 2, scope: !1, file: !2, type: !8) 39 !8 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !0, baseType: !9) 40 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 41 !10 = !DILocalVariable(name: "a", line: 3, scope: !11, file: !2, type: !9) 42 !11 = distinct !DILexicalBlock(line: 2, column: 25, file: !20, scope: !1) 43 !12 = !DILocation(line: 2, column: 13, scope: !1) 44 !13 = !DILocation(line: 2, column: 22, scope: !1) 45 !14 = !DILocation(line: 3, column: 14, scope: !11) 46 !15 = !DILocation(line: 4, column: 3, scope: !11) 47 !16 = !DILocation(line: 5, column: 5, scope: !11) 48 !17 = !DILocation(line: 7, column: 1, scope: !11) 49 !18 = !{!1} 50 !19 = !{!6, !7, !10} 51 !20 = !DIFile(filename: "a.c", directory: "/private/tmp") 52 !21 = !{} 53 !22 = !{i32 1, !"Debug Info Version", i32 3} 54