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