type-unique-type-array-b.ll 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. ; RUN: true
  2. ; This file belongs to type-unique-type-array-a.ll.
  3. ;
  4. ; rdar://problem/17628609
  5. ;
  6. ; cat -n b.cpp
  7. ; 1 struct SA {
  8. ; 2 int a;
  9. ; 3 };
  10. ; 4
  11. ; 5 class B {
  12. ; 6 public:
  13. ; 7 void testB(SA sa) {
  14. ; 8 }
  15. ; 9 };
  16. ; 10
  17. ; 11 void topB(B* b, SA sa) {
  18. ; 12 b->testB(sa);
  19. ; 13 }
  20. %class.B = type { i8 }
  21. %struct.SA = type { i32 }
  22. ; Function Attrs: ssp uwtable
  23. define void @_Z4topBP1B2SA(%class.B* %b, i32 %sa.coerce) #0 {
  24. entry:
  25. %sa = alloca %struct.SA, align 4
  26. %b.addr = alloca %class.B*, align 8
  27. %agg.tmp = alloca %struct.SA, align 4
  28. %coerce.dive = getelementptr %struct.SA, %struct.SA* %sa, i32 0, i32 0
  29. store i32 %sa.coerce, i32* %coerce.dive
  30. store %class.B* %b, %class.B** %b.addr, align 8
  31. call void @llvm.dbg.declare(metadata %class.B** %b.addr, metadata !24, metadata !DIExpression()), !dbg !25
  32. call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !26, metadata !DIExpression()), !dbg !27
  33. %0 = load %class.B*, %class.B** %b.addr, align 8, !dbg !28
  34. %1 = bitcast %struct.SA* %agg.tmp to i8*, !dbg !28
  35. %2 = bitcast %struct.SA* %sa to i8*, !dbg !28
  36. call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 4, i32 4, i1 false), !dbg !28
  37. %coerce.dive1 = getelementptr %struct.SA, %struct.SA* %agg.tmp, i32 0, i32 0, !dbg !28
  38. %3 = load i32, i32* %coerce.dive1, !dbg !28
  39. call void @_ZN1B5testBE2SA(%class.B* %0, i32 %3), !dbg !28
  40. ret void, !dbg !29
  41. }
  42. ; Function Attrs: nounwind readnone
  43. declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
  44. ; Function Attrs: nounwind ssp uwtable
  45. define linkonce_odr void @_ZN1B5testBE2SA(%class.B* %this, i32 %sa.coerce) #2 align 2 {
  46. entry:
  47. %sa = alloca %struct.SA, align 4
  48. %this.addr = alloca %class.B*, align 8
  49. %coerce.dive = getelementptr %struct.SA, %struct.SA* %sa, i32 0, i32 0
  50. store i32 %sa.coerce, i32* %coerce.dive
  51. store %class.B* %this, %class.B** %this.addr, align 8
  52. call void @llvm.dbg.declare(metadata %class.B** %this.addr, metadata !30, metadata !DIExpression()), !dbg !31
  53. call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !32, metadata !DIExpression()), !dbg !33
  54. %this1 = load %class.B*, %class.B** %this.addr
  55. ret void, !dbg !34
  56. }
  57. ; Function Attrs: nounwind
  58. declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3
  59. attributes #0 = { ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
  60. attributes #1 = { nounwind readnone }
  61. attributes #2 = { nounwind ssp uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
  62. attributes #3 = { nounwind }
  63. !llvm.dbg.cu = !{!0}
  64. !llvm.module.flags = !{!21, !22}
  65. !llvm.ident = !{!23}
  66. !0 = !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)", isOptimized: false, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !14, globals: !2, imports: !2)
  67. !1 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
  68. !2 = !{}
  69. !3 = !{!4, !10}
  70. !4 = !DICompositeType(tag: DW_TAG_class_type, name: "B", line: 5, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1B")
  71. !5 = !{!6}
  72. !6 = !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1B", type: !7)
  73. !7 = !DISubroutineType(types: !8)
  74. !8 = !{null, !9, !"_ZTS2SA"}
  75. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B")
  76. !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "SA", line: 1, size: 32, align: 32, file: !1, elements: !11, identifier: "_ZTS2SA")
  77. !11 = !{!12}
  78. !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !"_ZTS2SA", baseType: !13)
  79. !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  80. !14 = !{!15, !20}
  81. !15 = !DISubprogram(name: "topB", linkageName: "_Z4topBP1B2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, function: void (%class.B*, i32)* @_Z4topBP1B2SA, variables: !2)
  82. !16 = !DIFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
  83. !17 = !DISubroutineType(types: !18)
  84. !18 = !{null, !19, !"_ZTS2SA"}
  85. !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1B")
  86. !20 = !DISubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1B", type: !7, function: void (%class.B*, i32)* @_ZN1B5testBE2SA, declaration: !6, variables: !2)
  87. !21 = !{i32 2, !"Dwarf Version", i32 2}
  88. !22 = !{i32 2, !"Debug Info Version", i32 3}
  89. !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"}
  90. !24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 11, arg: 1, scope: !15, file: !16, type: !19)
  91. !25 = !DILocation(line: 11, column: 14, scope: !15)
  92. !26 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA")
  93. !27 = !DILocation(line: 11, column: 20, scope: !15)
  94. !28 = !DILocation(line: 12, column: 3, scope: !15)
  95. !29 = !DILocation(line: 13, column: 1, scope: !15)
  96. !30 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19)
  97. !31 = !DILocation(line: 0, scope: !20)
  98. !32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA")
  99. !33 = !DILocation(line: 7, column: 17, scope: !20)
  100. !34 = !DILocation(line: 8, column: 3, scope: !20)