inheritance.ll 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. ; RUN: llc %s -o /dev/null
  2. ; PR 2613.
  3. %struct.__class_type_info_pseudo = type { %struct.__type_info_pseudo }
  4. %struct.__type_info_pseudo = type { i8*, i8* }
  5. %struct.test1 = type { i32 (...)** }
  6. @_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]
  7. @_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]
  8. @_ZTVN10__cxxabiv117__class_type_infoE = external constant [0 x i32 (...)*] ; <[0 x i32 (...)*]*> [#uses=1]
  9. @_ZTS5test1 = weak_odr constant [7 x i8] c"5test1\00" ; <[7 x i8]*> [#uses=2]
  10. define i32 @main() nounwind ssp {
  11. entry:
  12. %retval = alloca i32 ; <i32*> [#uses=2]
  13. %0 = alloca i32 ; <i32*> [#uses=2]
  14. %tst = alloca %struct.test1 ; <%struct.test1*> [#uses=1]
  15. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  16. call void @llvm.dbg.declare(metadata %struct.test1* %tst, metadata !0, metadata !DIExpression()), !dbg !21
  17. call void @_ZN5test1C1Ev(%struct.test1* %tst) nounwind, !dbg !22
  18. store i32 0, i32* %0, align 4, !dbg !23
  19. %1 = load i32, i32* %0, align 4, !dbg !23 ; <i32> [#uses=1]
  20. store i32 %1, i32* %retval, align 4, !dbg !23
  21. br label %return, !dbg !23
  22. return: ; preds = %entry
  23. %retval1 = load i32, i32* %retval, !dbg !23 ; <i32> [#uses=1]
  24. ret i32 %retval1, !dbg !23
  25. }
  26. define linkonce_odr void @_ZN5test1C1Ev(%struct.test1* %this) nounwind ssp align 2 {
  27. entry:
  28. %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=2]
  29. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  30. call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !24, metadata !DIExpression()), !dbg !28
  31. store %struct.test1* %this, %struct.test1** %this_addr
  32. %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !28 ; <%struct.test1*> [#uses=1]
  33. %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !28 ; <i32 (...)***> [#uses=1]
  34. store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !28
  35. br label %return, !dbg !28
  36. return: ; preds = %entry
  37. ret void, !dbg !29
  38. }
  39. declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
  40. define linkonce_odr void @_ZN5test1D1Ev(%struct.test1* %this) nounwind ssp align 2 {
  41. entry:
  42. %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=3]
  43. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  44. call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !32, metadata !DIExpression()), !dbg !34
  45. store %struct.test1* %this, %struct.test1** %this_addr
  46. %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !35 ; <%struct.test1*> [#uses=1]
  47. %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !35 ; <i32 (...)***> [#uses=1]
  48. store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !35
  49. br label %bb, !dbg !37
  50. bb: ; preds = %entry
  51. %2 = trunc i32 0 to i8, !dbg !37 ; <i8> [#uses=1]
  52. %toBool = icmp ne i8 %2, 0, !dbg !37 ; <i1> [#uses=1]
  53. br i1 %toBool, label %bb1, label %bb2, !dbg !37
  54. bb1: ; preds = %bb
  55. %3 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !37 ; <%struct.test1*> [#uses=1]
  56. %4 = bitcast %struct.test1* %3 to i8*, !dbg !37 ; <i8*> [#uses=1]
  57. call void @_ZdlPv(i8* %4) nounwind, !dbg !37
  58. br label %bb2, !dbg !37
  59. bb2: ; preds = %bb1, %bb
  60. br label %return, !dbg !37
  61. return: ; preds = %bb2
  62. ret void, !dbg !37
  63. }
  64. define linkonce_odr void @_ZN5test1D0Ev(%struct.test1* %this) nounwind ssp align 2 {
  65. entry:
  66. %this_addr = alloca %struct.test1* ; <%struct.test1**> [#uses=3]
  67. %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  68. call void @llvm.dbg.declare(metadata %struct.test1** %this_addr, metadata !38, metadata !DIExpression()), !dbg !40
  69. store %struct.test1* %this, %struct.test1** %this_addr
  70. %0 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !41 ; <%struct.test1*> [#uses=1]
  71. %1 = getelementptr inbounds %struct.test1, %struct.test1* %0, i32 0, i32 0, !dbg !41 ; <i32 (...)***> [#uses=1]
  72. store i32 (...)** getelementptr inbounds ([4 x i32 (...)*], [4 x i32 (...)*]* @_ZTV5test1, i64 0, i64 2), i32 (...)*** %1, align 8, !dbg !41
  73. br label %bb, !dbg !43
  74. bb: ; preds = %entry
  75. %2 = trunc i32 1 to i8, !dbg !43 ; <i8> [#uses=1]
  76. %toBool = icmp ne i8 %2, 0, !dbg !43 ; <i1> [#uses=1]
  77. br i1 %toBool, label %bb1, label %bb2, !dbg !43
  78. bb1: ; preds = %bb
  79. %3 = load %struct.test1*, %struct.test1** %this_addr, align 8, !dbg !43 ; <%struct.test1*> [#uses=1]
  80. %4 = bitcast %struct.test1* %3 to i8*, !dbg !43 ; <i8*> [#uses=1]
  81. call void @_ZdlPv(i8* %4) nounwind, !dbg !43
  82. br label %bb2, !dbg !43
  83. bb2: ; preds = %bb1, %bb
  84. br label %return, !dbg !43
  85. return: ; preds = %bb2
  86. ret void, !dbg !43
  87. }
  88. declare void @_ZdlPv(i8*) nounwind
  89. !llvm.dbg.cu = !{!4}
  90. !0 = !DILocalVariable(name: "tst", line: 13, scope: !1, file: !4, type: !8)
  91. !1 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !2)
  92. !2 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !3)
  93. !3 = distinct !DISubprogram(name: "main", linkageName: "main", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, scope: !4, type: !5)
  94. !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)
  95. !5 = !DISubroutineType(types: !6)
  96. !6 = !{!7}
  97. !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  98. !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "test1", line: 1, size: 64, align: 64, file: !44, scope: !4, elements: !9, vtableHolder: !8)
  99. !9 = !{!10, !14, !18}
  100. !10 = !DIDerivedType(tag: DW_TAG_member, name: "_vptr$test1", line: 1, size: 64, align: 64, file: !44, scope: !8, baseType: !11)
  101. !11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !4, baseType: !12)
  102. !12 = !DIDerivedType(tag: DW_TAG_pointer_type, name: "__vtbl_ptr_type", scope: !4, baseType: !5)
  103. !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)
  104. !14 = !DISubprogram(name: "test1", line: 1, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrivate, isOptimized: false, scope: !8, type: !15)
  105. !15 = !DISubroutineType(types: !16)
  106. !16 = !{null, !17}
  107. !17 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !4, baseType: !8)
  108. !18 = !DISubprogram(name: "~test1", line: 4, isLocal: false, isDefinition: false, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, scope: !8, type: !19, containingType: !8)
  109. !19 = !DISubroutineType(types: !20)
  110. !20 = !{null, !17, !7}
  111. !21 = !DILocation(line: 11, scope: !1)
  112. !22 = !DILocation(line: 13, scope: !1)
  113. !23 = !DILocation(line: 14, scope: !1)
  114. !24 = !DILocalVariable(name: "this", line: 13, arg: 1, scope: !25, file: !4, type: !26)
  115. !25 = distinct !DISubprogram(name: "test1", linkageName: "_ZN5test1C1Ev", line: 1, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !4, scope: !4, type: !15)
  116. !26 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !4, baseType: !27)
  117. !27 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !4, baseType: !8)
  118. !28 = !DILocation(line: 1, scope: !25)
  119. !29 = !DILocation(line: 1, scope: !30)
  120. !30 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !31)
  121. !31 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !25)
  122. !32 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !33, file: !4, type: !26)
  123. !33 = distinct !DISubprogram(name: "~test1", linkageName: "_ZN5test1D1Ev", line: 4, isLocal: false, isDefinition: true, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, unit: !4, scope: !8, type: !15, containingType: !8)
  124. !34 = !DILocation(line: 4, scope: !33)
  125. !35 = !DILocation(line: 5, scope: !36)
  126. !36 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !33)
  127. !37 = !DILocation(line: 6, scope: !36)
  128. !38 = !DILocalVariable(name: "this", line: 4, arg: 1, scope: !39, file: !4, type: !26)
  129. !39 = distinct !DISubprogram(name: "~test1", linkageName: "_ZN5test1D0Ev", line: 4, isLocal: false, isDefinition: true, virtuality: DW_VIRTUALITY_virtual, virtualIndex: 6, isOptimized: false, unit: !4, scope: !8, type: !15, containingType: !8)
  130. !40 = !DILocation(line: 4, scope: !39)
  131. !41 = !DILocation(line: 5, scope: !42)
  132. !42 = distinct !DILexicalBlock(line: 0, column: 0, file: !44, scope: !39)
  133. !43 = !DILocation(line: 6, scope: !42)
  134. !44 = !DIFile(filename: "inheritance.cpp", directory: "/tmp/")
  135. !45 = !{i32 0}
  136. !46 = !DIFile(filename: "<built-in>", directory: "/tmp/")