1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O2 < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s 3*9880d681SAndroid Build Coastguard Workertarget 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*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-darwin10" 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Worker%struct.a = type { i32, %struct.a* } 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker@llvm.used = appending global [1 x i8*] [i8* bitcast (i8* (%struct.a*)* @bar to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0] 9*9880d681SAndroid Build Coastguard Worker 10*9880d681SAndroid Build Coastguard Workerdefine i8* @bar(%struct.a* %myvar) nounwind optsize noinline ssp !dbg !9 { 11*9880d681SAndroid Build Coastguard Workerentry: 12*9880d681SAndroid Build Coastguard Worker tail call void @llvm.dbg.value(metadata %struct.a* %myvar, i64 0, metadata !8, metadata !DIExpression()), !dbg !DILocation(scope: !9) 13*9880d681SAndroid Build Coastguard Worker %0 = getelementptr inbounds %struct.a, %struct.a* %myvar, i64 0, i32 0, !dbg !28 ; <i32*> [#uses=1] 14*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* %0, align 8, !dbg !28 ; <i32> [#uses=1] 15*9880d681SAndroid Build Coastguard Worker tail call void @foo(i32 %1) nounwind optsize noinline ssp, !dbg !28 16*9880d681SAndroid Build Coastguard Worker %2 = bitcast %struct.a* %myvar to i8*, !dbg !30 ; <i8*> [#uses=1] 17*9880d681SAndroid Build Coastguard Worker ret i8* %2, !dbg !30 18*9880d681SAndroid Build Coastguard Worker} 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Workerdeclare void @foo(i32) nounwind optsize noinline ssp 21*9880d681SAndroid Build Coastguard Worker 22*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone 23*9880d681SAndroid Build Coastguard Worker 24*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!2} 25*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!38} 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker!0 = !DIGlobalVariable(name: "ret", line: 7, isLocal: false, isDefinition: true, scope: !1, file: !1, type: !3) 28*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "foo.c", directory: "/tmp/") 29*9880d681SAndroid Build Coastguard Worker!2 = distinct !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !36, enums: !37, retainedTypes: !37, globals: !31, imports: !37) 30*9880d681SAndroid Build Coastguard Worker!3 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 31*9880d681SAndroid Build Coastguard Worker!4 = !DILocalVariable(name: "x", line: 12, arg: 1, scope: !5, file: !1, type: !3) 32*9880d681SAndroid Build Coastguard Worker!5 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 13, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, scopeLine: 13, file: !36, scope: !1, type: !6, variables: !33) 33*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7) 34*9880d681SAndroid Build Coastguard Worker!7 = !{null, !3} 35*9880d681SAndroid Build Coastguard Worker!8 = !DILocalVariable(name: "myvar", line: 17, arg: 1, scope: !9, file: !1, type: !13) 36*9880d681SAndroid Build Coastguard Worker!9 = distinct !DISubprogram(name: "bar", linkageName: "bar", line: 17, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, scopeLine: 17, file: !36, scope: !1, type: !10, variables: !34) 37*9880d681SAndroid Build Coastguard Worker!10 = !DISubroutineType(types: !11) 38*9880d681SAndroid Build Coastguard Worker!11 = !{!12, !13} 39*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !36, scope: !1, baseType: null) 40*9880d681SAndroid Build Coastguard Worker!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !36, scope: !1, baseType: !14) 41*9880d681SAndroid Build Coastguard Worker!14 = !DICompositeType(tag: DW_TAG_structure_type, name: "a", line: 2, size: 128, align: 64, file: !36, scope: !1, elements: !15) 42*9880d681SAndroid Build Coastguard Worker!15 = !{!16, !17} 43*9880d681SAndroid Build Coastguard Worker!16 = !DIDerivedType(tag: DW_TAG_member, name: "c", line: 3, size: 32, align: 32, file: !36, scope: !14, baseType: !3) 44*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_member, name: "d", line: 4, size: 64, align: 64, offset: 64, file: !36, scope: !14, baseType: !13) 45*9880d681SAndroid Build Coastguard Worker!18 = !DILocalVariable(name: "argc", line: 22, arg: 1, scope: !19, file: !1, type: !3) 46*9880d681SAndroid Build Coastguard Worker!19 = distinct !DISubprogram(name: "main", linkageName: "main", line: 22, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !2, scopeLine: 22, file: !36, scope: !1, type: !20, variables: !35) 47*9880d681SAndroid Build Coastguard Worker!20 = !DISubroutineType(types: !21) 48*9880d681SAndroid Build Coastguard Worker!21 = !{!3, !3, !22} 49*9880d681SAndroid Build Coastguard Worker!22 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !36, scope: !1, baseType: !23) 50*9880d681SAndroid Build Coastguard Worker!23 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !36, scope: !1, baseType: !24) 51*9880d681SAndroid Build Coastguard Worker!24 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 52*9880d681SAndroid Build Coastguard Worker!25 = !DILocalVariable(name: "argv", line: 22, arg: 2, scope: !19, file: !1, type: !22) 53*9880d681SAndroid Build Coastguard Worker!26 = !DILocalVariable(name: "e", line: 23, scope: !27, file: !1, type: !14) 54*9880d681SAndroid Build Coastguard Worker!27 = distinct !DILexicalBlock(line: 22, column: 0, file: !36, scope: !19) 55*9880d681SAndroid Build Coastguard Worker!28 = !DILocation(line: 18, scope: !29) 56*9880d681SAndroid Build Coastguard Worker!29 = distinct !DILexicalBlock(line: 17, column: 0, file: !36, scope: !9) 57*9880d681SAndroid Build Coastguard Worker!30 = !DILocation(line: 19, scope: !29) 58*9880d681SAndroid Build Coastguard Worker!31 = !{!0} 59*9880d681SAndroid Build Coastguard Worker!33 = !{!4} 60*9880d681SAndroid Build Coastguard Worker!34 = !{!8} 61*9880d681SAndroid Build Coastguard Worker!35 = !{!18, !25, !26} 62*9880d681SAndroid Build Coastguard Worker!36 = !DIFile(filename: "foo.c", directory: "/tmp/") 63*9880d681SAndroid Build Coastguard Worker!37 = !{} 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard Worker; The variable bar:myvar changes registers after the first movq. 66*9880d681SAndroid Build Coastguard Worker; It is cobbered by popq %rbx 67*9880d681SAndroid Build Coastguard Worker; CHECK: movq 68*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[LABEL:Ltmp[0-9]*]] 69*9880d681SAndroid Build Coastguard Worker; CHECK: .loc 1 19 0 70*9880d681SAndroid Build Coastguard Worker; CHECK: popq 71*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[CLOBBER:Ltmp[0-9]*]] 72*9880d681SAndroid Build Coastguard Worker 73*9880d681SAndroid Build Coastguard Worker 74*9880d681SAndroid Build Coastguard Worker; CHECK: Ldebug_loc0: 75*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[SET1:.*]] = Lfunc_begin0-Lfunc_begin0 76*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .quad [[SET1]] 77*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[SET2:.*]] = [[LABEL]]-Lfunc_begin0 78*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .quad [[SET2]] 79*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .short 1 ## Loc expr size 80*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .byte 85 81*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[SET3:.*]] = [[LABEL]]-Lfunc_begin0 82*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .quad [[SET3]] 83*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: [[SET4:.*]] = [[CLOBBER]]-Lfunc_begin0 84*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .quad [[SET4]] 85*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .short 1 ## Loc expr size 86*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: .byte 83 87*9880d681SAndroid Build Coastguard Worker!38 = !{i32 1, !"Debug Info Version", i32 3} 88