aa1bf4aaf5f1b4fe56c53d88ad32201a36a6cb33
[oota-llvm.git] / test / DebugInfo / X86 / 2010-04-13-PubType.ll
1 ; RUN: llc -O0 -asm-verbose -mtriple=x86_64-macosx -generate-dwarf-pub-sections=Enable < %s | FileCheck %s
2 ; CHECK-NOT: .asciz "X" ## External Name
3 ; CHECK: .asciz "Y" ## External Name
4 ; Test to check type with no definition is listed in pubtypes section.
5 %struct.X = type opaque
6 %struct.Y = type { i32 }
7
8 define i32 @foo(%struct.X* %x, %struct.Y* %y) nounwind ssp {
9 entry:
10   %x_addr = alloca %struct.X*                     ; <%struct.X**> [#uses=1]
11   %y_addr = alloca %struct.Y*                     ; <%struct.Y**> [#uses=1]
12   %retval = alloca i32                            ; <i32*> [#uses=2]
13   %0 = alloca i32                                 ; <i32*> [#uses=2]
14   %"alloca point" = bitcast i32 0 to i32          ; <i32> [#uses=0]
15   call void @llvm.dbg.declare(metadata %struct.X** %x_addr, metadata !0, metadata !DIExpression()), !dbg !13
16   store %struct.X* %x, %struct.X** %x_addr
17   call void @llvm.dbg.declare(metadata %struct.Y** %y_addr, metadata !14, metadata !DIExpression()), !dbg !13
18   store %struct.Y* %y, %struct.Y** %y_addr
19   store i32 0, i32* %0, align 4, !dbg !13
20   %1 = load i32, i32* %0, align 4, !dbg !13            ; <i32> [#uses=1]
21   store i32 %1, i32* %retval, align 4, !dbg !13
22   br label %return, !dbg !13
23
24 return:                                           ; preds = %entry
25   %retval1 = load i32, i32* %retval, !dbg !13          ; <i32> [#uses=1]
26   ret i32 %retval1, !dbg !15
27 }
28
29 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
30
31 !llvm.dbg.cu = !{!3}
32 !llvm.module.flags = !{!20}
33
34 !0 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 7, arg: 1, scope: !1, file: !2, type: !7)
35 !1 = !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 7, file: !18, scope: !2, type: !4, function: i32 (%struct.X*, %struct.Y*)* @foo)
36 !2 = !DIFile(filename: "a.c", directory: "/tmp/")
37 !3 = !DICompileUnit(language: DW_LANG_C89, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: 0, file: !18, enums: !19, retainedTypes: !19, subprograms: !17, imports:  null)
38 !4 = !DISubroutineType(types: !5)
39 !5 = !{!6, !7, !9}
40 !6 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
41 !7 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !18, scope: !2, baseType: !8)
42 !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line: 3, flags: DIFlagFwdDecl, file: !18, scope: !2)
43 !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !18, scope: !2, baseType: !10)
44 !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "Y", line: 4, size: 32, align: 32, file: !18, scope: !2, elements: !11)
45 !11 = !{!12}
46 !12 = !DIDerivedType(tag: DW_TAG_member, name: "x", line: 5, size: 32, align: 32, file: !18, scope: !10, baseType: !6)
47 !13 = !DILocation(line: 7, scope: !1)
48 !14 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "y", line: 7, arg: 2, scope: !1, file: !2, type: !9)
49 !15 = !DILocation(line: 7, scope: !16)
50 !16 = distinct !DILexicalBlock(line: 7, column: 0, file: !18, scope: !1)
51 !17 = !{!1}
52 !18 = !DIFile(filename: "a.c", directory: "/tmp/")
53 !19 = !{}
54 !20 = !{i32 1, !"Debug Info Version", i32 3}