blob: 803d0d674abc00af85c39c2ded794cbfa9185111 [file] [log] [blame]
David Majnemer3128b102016-06-15 18:00:01 +00001; RUN: llc < %s -filetype=obj | llvm-readobj - -codeview | FileCheck %s
2target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
3target triple = "i686-pc-windows-msvc18.0.0"
4
5; C++ source to regenerate:
6; $ cat t.cpp
7; void f() {
8; typedef int FOO;
9; FOO f;
10; }
Hans Wennborg4b63a982016-06-23 22:57:25 +000011;
12; struct S { int x; };
13; float g(S *s) {
14; union pun { int x; float f; } p;
15; p.x = s->x;
16; return p.f;
17; }
David Majnemer3128b102016-06-15 18:00:01 +000018
19; CHECK: ProcStart {
20; CHECK: DisplayName: f
21; CHECK: LinkageName: ?f@@YAXXZ
22; CHECK: }
23; CHECK: UDT {
24; CHECK-NEXT: Type: int (0x74)
25; CHECK-NEXT: UDTName: f::FOO
26; CHECK-NEXT: }
27; CHECK-NEXT: ProcEnd {
28; CHECK-NEXT: }
29
Hans Wennborg4b63a982016-06-23 22:57:25 +000030; CHECK: ProcStart {
31; CHECK: DisplayName: g
32; CHECK: LinkageName: ?g@@YAMPEAUS@@@Z
33; CHECK: }
34; CHECK: UDT {
35; CHECK-NEXT: Type: g::pun (0x{{[0-9A-F]+}})
36; CHECK-NEXT: UDTName: g::pun
37; CHECK-NEXT: }
38; CHECK-NEXT: ProcEnd {
39; CHECK-NEXT: }
David Majnemer3128b102016-06-15 18:00:01 +000040
Hans Wennborg4b63a982016-06-23 22:57:25 +000041; CHECK: Subsection
42; CHECK-NOT: ProcStart
43; CHECK: UDT {
44; CHECK-NEXT: Type: S (0x{{[0-9A-F]+}})
45; CHECK-NEXT: UDTName: S
46
47
48%struct.S = type { i32 }
49%union.pun = type { i32 }
50
51; Function Attrs: nounwind uwtable
52define void @"\01?f@@YAXXZ"() #0 !dbg !7 {
David Majnemer3128b102016-06-15 18:00:01 +000053entry:
54 %f = alloca i32, align 4
55 call void @llvm.dbg.declare(metadata i32* %f, metadata !10, metadata !13), !dbg !14
56 ret void, !dbg !15
57}
58
59; Function Attrs: nounwind readnone
60declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
61
Hans Wennborg4b63a982016-06-23 22:57:25 +000062; Function Attrs: nounwind uwtable
63define float @"\01?g@@YAMPEAUS@@@Z"(%struct.S* %s) #0 !dbg !16 {
64entry:
65 %s.addr = alloca %struct.S*, align 8
66 %p = alloca %union.pun, align 4
67 store %struct.S* %s, %struct.S** %s.addr, align 8
68 call void @llvm.dbg.declare(metadata %struct.S** %s.addr, metadata !24, metadata !13), !dbg !25
69 call void @llvm.dbg.declare(metadata %union.pun* %p, metadata !26, metadata !13), !dbg !31
70 %0 = load %struct.S*, %struct.S** %s.addr, align 8, !dbg !32
71 %x = getelementptr inbounds %struct.S, %struct.S* %0, i32 0, i32 0, !dbg !33
72 %1 = load i32, i32* %x, align 4, !dbg !33
73 %x1 = bitcast %union.pun* %p to i32*, !dbg !34
74 store i32 %1, i32* %x1, align 4, !dbg !35
75 %f = bitcast %union.pun* %p to float*, !dbg !36
76 %2 = load float, float* %f, align 4, !dbg !36
77 ret float %2, !dbg !37
78}
79
80attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
David Majnemer3128b102016-06-15 18:00:01 +000081attributes #1 = { nounwind readnone }
82
83!llvm.dbg.cu = !{!0}
Hans Wennborg4b63a982016-06-23 22:57:25 +000084!llvm.module.flags = !{!3, !4, !5}
85!llvm.ident = !{!6}
David Majnemer3128b102016-06-15 18:00:01 +000086
Hans Wennborg4b63a982016-06-23 22:57:25 +000087!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 273566) (llvm/trunk 273570)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
88!1 = !DIFile(filename: "t.cpp", directory: "/usr/local/google/work/llvm/build.release")
David Majnemer3128b102016-06-15 18:00:01 +000089!2 = !{}
90!3 = !{i32 2, !"CodeView", i32 1}
91!4 = !{i32 2, !"Debug Info Version", i32 3}
Hans Wennborg4b63a982016-06-23 22:57:25 +000092!5 = !{i32 1, !"PIC Level", i32 2}
93!6 = !{!"clang version 3.9.0 (trunk 273566) (llvm/trunk 273570)"}
94!7 = distinct !DISubprogram(name: "f", linkageName: "\01?f@@YAXXZ", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
David Majnemer3128b102016-06-15 18:00:01 +000095!8 = !DISubroutineType(types: !9)
96!9 = !{null}
Hans Wennborg4b63a982016-06-23 22:57:25 +000097!10 = !DILocalVariable(name: "f", scope: !7, file: !1, line: 3, type: !11)
98!11 = !DIDerivedType(tag: DW_TAG_typedef, name: "FOO", scope: !7, file: !1, line: 2, baseType: !12)
David Majnemer3128b102016-06-15 18:00:01 +000099!12 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
100!13 = !DIExpression()
Hans Wennborg4b63a982016-06-23 22:57:25 +0000101!14 = !DILocation(line: 3, column: 7, scope: !7)
102!15 = !DILocation(line: 4, column: 1, scope: !7)
103!16 = distinct !DISubprogram(name: "g", linkageName: "\01?g@@YAMPEAUS@@@Z", scope: !1, file: !1, line: 7, type: !17, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
104!17 = !DISubroutineType(types: !18)
105!18 = !{!19, !20}
106!19 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
107!20 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !21, size: 64, align: 64)
108!21 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "S", file: !1, line: 6, size: 32, align: 32, elements: !22, identifier: ".?AUS@@")
109!22 = !{!23}
110!23 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !21, file: !1, line: 6, baseType: !12, size: 32, align: 32)
111!24 = !DILocalVariable(name: "s", arg: 1, scope: !16, file: !1, line: 7, type: !20)
112!25 = !DILocation(line: 7, column: 12, scope: !16)
113!26 = !DILocalVariable(name: "p", scope: !16, file: !1, line: 8, type: !27)
114!27 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "pun", scope: !16, file: !1, line: 8, size: 32, align: 32, elements: !28)
115!28 = !{!29, !30}
116!29 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !27, file: !1, line: 8, baseType: !12, size: 32, align: 32)
117!30 = !DIDerivedType(tag: DW_TAG_member, name: "f", scope: !27, file: !1, line: 8, baseType: !19, size: 32, align: 32)
118!31 = !DILocation(line: 8, column: 33, scope: !16)
119!32 = !DILocation(line: 9, column: 9, scope: !16)
120!33 = !DILocation(line: 9, column: 12, scope: !16)
121!34 = !DILocation(line: 9, column: 5, scope: !16)
122!35 = !DILocation(line: 9, column: 7, scope: !16)
123!36 = !DILocation(line: 10, column: 12, scope: !16)
124!37 = !DILocation(line: 10, column: 3, scope: !16)