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