1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-apple-darwin10 < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker%struct.a = type { i32 } 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard Workerdefine i32 @bar(%struct.a* nocapture %b) nounwind ssp !dbg !0 { 6*9880d681SAndroid Build Coastguard Workerentry: 7*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata %struct.a* %b, i64 0, metadata !6, metadata !DIExpression()), !dbg !13 8*9880d681SAndroid Build Coastguard Worker %tmp1 = getelementptr inbounds %struct.a, %struct.a* %b, i64 0, i32 0, !dbg !14 9*9880d681SAndroid Build Coastguard Worker %tmp2 = load i32, i32* %tmp1, align 4, !dbg !14 10*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata i32 %tmp2, i64 0, metadata !11, metadata !DIExpression()), !dbg !14 11*9880d681SAndroid Build Coastguard Worker %call = tail call i32 (...) @foo(i32 %tmp2) nounwind , !dbg !18 12*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %tmp2, 1, !dbg !19 13*9880d681SAndroid Build Coastguard Worker ret i32 %add, !dbg !19 14*9880d681SAndroid Build Coastguard Worker} 15*9880d681SAndroid Build Coastguard Worker 16*9880d681SAndroid Build Coastguard Workerdeclare i32 @foo(...) 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!2} 21*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!24} 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Worker!0 = distinct !DISubprogram(name: "bar", line: 5, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !2, file: !22, scope: !1, type: !3, variables: !21) 24*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "bar.c", directory: "/private/tmp") 25*9880d681SAndroid Build Coastguard Worker!2 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 2.9 (trunk 122997)", isOptimized: true, emissionKind: FullDebug, file: !22, enums: !23, retainedTypes: !23, imports: null) 26*9880d681SAndroid Build Coastguard Worker!3 = !DISubroutineType(types: !4) 27*9880d681SAndroid Build Coastguard Worker!4 = !{!5} 28*9880d681SAndroid Build Coastguard Worker!5 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 29*9880d681SAndroid Build Coastguard Worker!6 = !DILocalVariable(name: "b", line: 5, arg: 1, scope: !0, file: !1, type: !7) 30*9880d681SAndroid Build Coastguard Worker!7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, scope: !2, baseType: !8) 31*9880d681SAndroid Build Coastguard Worker!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", line: 1, size: 32, align: 32, file: !22, scope: !2, elements: !9) 32*9880d681SAndroid Build Coastguard Worker!9 = !{!10} 33*9880d681SAndroid Build Coastguard Worker!10 = !DIDerivedType(tag: DW_TAG_member, name: "c", line: 2, size: 32, align: 32, file: !22, scope: !1, baseType: !5) 34*9880d681SAndroid Build Coastguard Worker!11 = !DILocalVariable(name: "x", line: 6, scope: !12, file: !1, type: !5) 35*9880d681SAndroid Build Coastguard Worker!12 = distinct !DILexicalBlock(line: 5, column: 22, file: !22, scope: !0) 36*9880d681SAndroid Build Coastguard Worker!13 = !DILocation(line: 5, column: 19, scope: !0) 37*9880d681SAndroid Build Coastguard Worker!14 = !DILocation(line: 6, column: 14, scope: !12) 38*9880d681SAndroid Build Coastguard Worker!18 = !DILocation(line: 7, column: 2, scope: !12) 39*9880d681SAndroid Build Coastguard Worker!19 = !DILocation(line: 8, column: 2, scope: !12) 40*9880d681SAndroid Build Coastguard Worker!21 = !{!6, !11} 41*9880d681SAndroid Build Coastguard Worker!22 = !DIFile(filename: "bar.c", directory: "/private/tmp") 42*9880d681SAndroid Build Coastguard Worker!23 = !{} 43*9880d681SAndroid Build Coastguard Worker 44*9880d681SAndroid Build Coastguard Worker; Check that variable bar:b value range is appropriately truncated in debug info. 45*9880d681SAndroid Build Coastguard Worker; The variable is in %rdi which is clobbered by 'movl %ebx, %edi' 46*9880d681SAndroid Build Coastguard Worker; Here Ltmp7 is the end of the location range. 47*9880d681SAndroid Build Coastguard Worker 48*9880d681SAndroid Build Coastguard Worker;CHECK: .loc 1 7 2 49*9880d681SAndroid Build Coastguard Worker;CHECK: movl 50*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]] 51*9880d681SAndroid Build Coastguard Worker 52*9880d681SAndroid Build Coastguard Worker;CHECK:Ldebug_loc0: 53*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: Lset{{.*}} = 54*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .quad 55*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: [[CLOBBER_OFF:Lset.*]] = [[CLOBBER]]-{{.*}} 56*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .quad [[CLOBBER_OFF]] 57*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .short 1 ## Loc expr size 58*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .byte 85 ## DW_OP_reg 59*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .quad 0 60*9880d681SAndroid Build Coastguard Worker;CHECK-NEXT: .quad 0 61*9880d681SAndroid Build Coastguard Worker!24 = !{i32 1, !"Debug Info Version", i32 3} 62