blob: b7cbf21633039e4349013b671e90acaaf476320e [file] [log] [blame]
Manman Rene8064c92013-07-24 18:56:43 +00001; RUN: llc %s -o /dev/null
Devang Pateldd596b12010-03-01 19:02:51 +00002; PR 2613.
3
4%struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
5%struct.__type_info_pseudo = type { i8*, i8* }
6%struct.test1 = type { i32 (...)** }
7
8@_ZTV5test1 = weak_odr constant [4 x i32 (...)*] [i32 (...)* null, i32 (...)* bitcast (%struct.__class_type_info_pseudo* @_ZTI5test1 to i32 (...)*), i32 (...)* bitcast (void (%struct.test1*)* @_ZN5test1D1Ev to i32 (...)*), i32 (...)* bitcast (void (%struct.test1*)* @_ZN5test1D0Ev to i32 (...)*)], align 32 ; <[4 x i32 (...)*]*> [#uses=1]
David Blaikief72d05b2015-03-13 18:20:45 +00009@_ZTI5test1 = weak_odr constant %struct.__class_type_info_pseudo { %struct.__type_info_pseudo { i8* inttoptr (i64 add (i64 ptrtoint ([0 x i32 (...)*]* @_ZTVN10__cxxabiv117__class_type_infoE to i64), i64 16) to i8*), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @_ZTS5test1, i64 0, i64 0) } }, align 16 ; <%struct.__class_type_info_pseudo*> [#uses=1]
Devang Pateldd596b12010-03-01 19:02:51 +000010@_ZTVN10__cxxabiv117__class_type_infoE = external constant [0 x i32 (...)*] ; <[0 x i32 (...)*]*> [#uses=1]
11@_ZTS5test1 = weak_odr constant [7 x i8] c"5test1\00" ; <[7 x i8]*> [#uses=2]
12
13define i32 @main() nounwind ssp {
14entry:
15 %retval = alloca i32 ; <i32*> [#uses=2]
16 %0 = alloca i32 ; <i32*> [#uses=2]
17 %tst = alloca %struct.test1 ; <%struct.test1*> [#uses=1]
18 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000019 call void @llvm.dbg.declare(metadata %struct.test1* %tst, metadata !0, metadata !DIExpression()), !dbg !21
Devang Pateldd596b12010-03-01 19:02:51 +000020 call void @_ZN5test1C1Ev(%struct.test1* %tst) nounwind, !dbg !22
21 store i32 0, i32* %0, align 4, !dbg !23
David Blaikiea79ac142015-02-27 21:17:42 +000022 %1 = load i32, i32* %0, align 4, !dbg !23 ; <i32> [#uses=1]
Devang Pateldd596b12010-03-01 19:02:51 +000023 store i32 %1, i32* %retval, align 4, !dbg !23
24 br label %return, !dbg !23
25
26return: ; preds = %entry
David Blaikiea79ac142015-02-27 21:17:42 +000027 %retval1 = load i32, i32* %retval, !dbg !23 ; <i32> [#uses=1]
Devang Pateldd596b12010-03-01 19:02:51 +000028 ret i32 %retval1, !dbg !23
29}
30
31define linkonce_odr void @_ZN5test1C1Ev(%struct.test1* %this) nounwind ssp align 2 {
32entry:
33 %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=2]
34 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000035 call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !24, metadata !DIExpression()), !dbg !28
Devang Pateldd596b12010-03-01 19:02:51 +000036 store %struct.test1* %this, %struct.test1** %this_addr
David Blaikiea79ac142015-02-27 21:17:42 +000037 %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !28 ; <%struct.test1*> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000038 %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !28 ; <i32 (...)***> [#uses=1]
David Blaikief72d05b2015-03-13 18:20:45 +000039 store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !28
Devang Pateldd596b12010-03-01 19:02:51 +000040 br label %return, !dbg !28
41
42return: ; preds = %entry
43 ret void, !dbg !29
44}
45
Adrian Prantl87b7eb92014-10-01 18:55:02 +000046declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Devang Pateldd596b12010-03-01 19:02:51 +000047
48define linkonce_odr void @_ZN5test1D1Ev(%struct.test1* %this) nounwind ssp align 2 {
49entry:
50 %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=3]
51 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000052 call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !32, metadata !DIExpression()), !dbg !34
Devang Pateldd596b12010-03-01 19:02:51 +000053 store %struct.test1* %this, %struct.test1** %this_addr
David Blaikiea79ac142015-02-27 21:17:42 +000054 %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !35 ; <%struct.test1*> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000055 %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !35 ; <i32 (...)***> [#uses=1]
David Blaikief72d05b2015-03-13 18:20:45 +000056 store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !35
Devang Pateldd596b12010-03-01 19:02:51 +000057 br label %bb, !dbg !37
58
59bb: ; preds = %entry
60 %2 = trunc i32 0 to i8, !dbg !37 ; <i8> [#uses=1]
61 %toBool = icmp ne i8 %2, 0, !dbg !37 ; <i1> [#uses=1]
62 br i1 %toBool, label %bb1, label %bb2, !dbg !37
63
64bb1: ; preds = %bb
David Blaikiea79ac142015-02-27 21:17:42 +000065 %3 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !37 ; <%struct.test1*> [#uses=1]
Devang Pateldd596b12010-03-01 19:02:51 +000066 %4 = bitcast %struct.test1* %3 to i8*, !dbg !37 ; <i8*> [#uses=1]
67 call void @_ZdlPv(i8* %4) nounwind, !dbg !37
68 br label %bb2, !dbg !37
69
70bb2: ; preds = %bb1, %bb
71 br label %return, !dbg !37
72
73return: ; preds = %bb2
74 ret void, !dbg !37
75}
76
77define linkonce_odr void @_ZN5test1D0Ev(%struct.test1* %this) nounwind ssp align 2 {
78entry:
79 %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=3]
80 %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000081 call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !38, metadata !DIExpression()), !dbg !40
Devang Pateldd596b12010-03-01 19:02:51 +000082 store %struct.test1* %this, %struct.test1** %this_addr
David Blaikiea79ac142015-02-27 21:17:42 +000083 %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !41 ; <%struct.test1*> [#uses=1]
David Blaikie79e6c742015-02-27 19:29:02 +000084 %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !41 ; <i32 (...)***> [#uses=1]
David Blaikief72d05b2015-03-13 18:20:45 +000085 store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !41
Devang Pateldd596b12010-03-01 19:02:51 +000086 br label %bb, !dbg !43
87
88bb: ; preds = %entry
89 %2 = trunc i32 1 to i8, !dbg !43 ; <i8> [#uses=1]
90 %toBool = icmp ne i8 %2, 0, !dbg !43 ; <i1> [#uses=1]
91 br i1 %toBool, label %bb1, label %bb2, !dbg !43
92
93bb1: ; preds = %bb
David Blaikiea79ac142015-02-27 21:17:42 +000094 %3 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !43 ; <%struct.test1*> [#uses=1]
Devang Pateldd596b12010-03-01 19:02:51 +000095 %4 = bitcast %struct.test1* %3 to i8*, !dbg !43 ; <i8*> [#uses=1]
96 call void @_ZdlPv(i8* %4) nounwind, !dbg !43
97 br label %bb2, !dbg !43
98
99bb2: ; preds = %bb1, %bb
100 br label %return, !dbg !43
101
102return: ; preds = %bb2
103 ret void, !dbg !43
104}
105
106declare void @_ZdlPv(i8*) nounwind
107
Adrian Prantlb01a4d42016-04-11 15:53:44 +0000108!llvm.dbg.cu = !{!4}
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000109!0 = !DILocalVariable(name: "tst", line: 13, scope: !1, file: !4, type: !8)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000110!1 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !2)
111!2 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !3)
Duncan P. N. Exon Smith814b8e92015-08-28 20:26:49 +0000112!3 = distinct !DISubprogram(name: "main", linkageName: "main", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !4, type: !5)
Adrian Prantlb8089512016-04-01 00:16:49 +0000113!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: true, emissionKind: FullDebug, file: !44, enums: !45, retainedTypes: !45)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000114!5 = !DISubroutineType(types: !6)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000115!6 = !{!7}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000116!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
117!8 = !DICompositeType(tag: DW_TAG_structure_type, name: "test1", line: 1, size: 64, align: 64, file: !44, scope: !4, elements: !9, vtableHolder: !8)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000118!9 = !{!10, !14, !18}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000119!10 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$test1", line: 1, size: 64, align: 64, file: !44, scope: !8, baseType: !11)
120!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !4, baseType: !12)
121!12 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", scope: !4, baseType: !5)
Adrian Prantlb8089512016-04-01 00:16:49 +0000122!13 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 (Based on Apple Inc. build 5658) (LLVM build)", isOptimized: false, emissionKind: FullDebug, file: !46, enums: !45, retainedTypes: !45)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000123!14 = !DISubprogram(name: "test1", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrivate, isOptimized: false, scope: !8, type: !15)
124!15 = !DISubroutineType(types: !16)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000125!16 = !{null, !17}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000126!17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !4, baseType: !8)
127!18 = !DISubprogram(name: "~test1", line: 4, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, scope: !8, type: !19, containingType: !8)
128!19 = !DISubroutineType(types: !20)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000129!20 = !{null, !17, !7}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000130!21 = !DILocation(line: 11, scope: !1)
131!22 = !DILocation(line: 13, scope: !1)
132!23 = !DILocation(line: 14, scope: !1)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000133!24 = !DILocalVariable(name: "this", line: 13, arg: 1, scope: !25, file: !4, type: !26)
Duncan P. N. Exon Smith814b8e92015-08-28 20:26:49 +0000134!25 = distinct !DISubprogram(name: "test1", linkageName: "_ZN5test1C1Ev", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scope: !4, type: !15)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000135!26 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !4, baseType: !27)
136!27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !4, baseType: !8)
137!28 = !DILocation(line: 1, scope: !25)
138!29 = !DILocation(line: 1, scope: !30)
139!30 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !31)
140!31 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !25)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000141!32 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !33, file: !4, type: !26)
Duncan P. N. Exon Smith814b8e92015-08-28 20:26:49 +0000142!33 = distinct !DISubprogram(name: "~test1", linkageName: "_ZN5test1D1Ev", line: 4, isLocal: false, isDefinition: true, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, scope: !8, type: !15, containingType: !8)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000143!34 = !DILocation(line: 4, scope: !33)
144!35 = !DILocation(line: 5, scope: !36)
145!36 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !33)
146!37 = !DILocation(line: 6, scope: !36)
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +0000147!38 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !39, file: !4, type: !26)
Duncan P. N. Exon Smith814b8e92015-08-28 20:26:49 +0000148!39 = distinct !DISubprogram(name: "~test1", linkageName: "_ZN5test1D0Ev", line: 4, isLocal: false, isDefinition: true, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, scope: !8, type: !15, containingType: !8)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000149!40 = !DILocation(line: 4, scope: !39)
150!41 = !DILocation(line: 5, scope: !42)
151!42 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !39)
152!43 = !DILocation(line: 6, scope: !42)
153!44 = !DIFile(filename: "inheritance.cpp", directory: "/tmp/")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000154!45 = !{i32 0}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +0000155!46 = !DIFile(filename: "<built-in>", directory: "/tmp/")