type-unique-type-array-a.ll 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. ; REQUIRES: object-emission
  2. ;
  3. ; RUN: llvm-link %s %p/type-unique-type-array-b.ll -S -o - | %llc_dwarf -filetype=obj -O0 | llvm-dwarfdump -debug-dump=info - | FileCheck %s
  4. ;
  5. ; rdar://problem/17628609
  6. ;
  7. ; cat -n a.cpp
  8. ; 1 struct SA {
  9. ; 2 int a;
  10. ; 3 };
  11. ; 4
  12. ; 5 class A {
  13. ; 6 public:
  14. ; 7 void testA(SA a) {
  15. ; 8 }
  16. ; 9 };
  17. ; 10
  18. ; 11 void topA(A *a, SA sa) {
  19. ; 12 a->testA(sa);
  20. ; 13 }
  21. ;
  22. ; CHECK: DW_TAG_compile_unit
  23. ; CHECK: DW_TAG_class_type
  24. ; CHECK-NEXT: DW_AT_name {{.*}} "A"
  25. ; CHECK: DW_TAG_subprogram
  26. ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1A5testAE2SA"
  27. ; CHECK: DW_TAG_formal_parameter
  28. ; CHECK: DW_TAG_formal_parameter
  29. ; CHECK-NEXT: DW_AT_type [DW_FORM_ref4] (cu + 0x{{.*}} => {0x[[STRUCT:.*]]})
  30. ; CHECK: 0x[[STRUCT]]: DW_TAG_structure_type
  31. ; CHECK-NEXT: DW_AT_name {{.*}} "SA"
  32. ; CHECK: DW_TAG_compile_unit
  33. ; CHECK: DW_TAG_class_type
  34. ; CHECK-NEXT: DW_AT_name {{.*}} "B"
  35. ; CHECK: DW_TAG_subprogram
  36. ; CHECK: DW_AT_MIPS_linkage_name {{.*}} "_ZN1B5testBE2SA"
  37. ; CHECK: DW_TAG_formal_parameter
  38. ; CHECK: DW_TAG_formal_parameter
  39. ; CHECK-NEXT: DW_AT_type [DW_FORM_ref_addr] {{.*}}[[STRUCT]]
  40. %class.A = type { i8 }
  41. %struct.SA = type { i32 }
  42. ; Function Attrs: ssp uwtable
  43. define void @_Z4topAP1A2SA(%class.A* %a, i32 %sa.coerce) #0 {
  44. entry:
  45. %sa = alloca %struct.SA, align 4
  46. %a.addr = alloca %class.A*, align 8
  47. %agg.tmp = alloca %struct.SA, align 4
  48. %coerce.dive = getelementptr %struct.SA, %struct.SA* %sa, i32 0, i32 0
  49. store i32 %sa.coerce, i32* %coerce.dive
  50. store %class.A* %a, %class.A** %a.addr, align 8
  51. call void @llvm.dbg.declare(metadata %class.A** %a.addr, metadata !24, metadata !DIExpression()), !dbg !25
  52. call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !26, metadata !DIExpression()), !dbg !27
  53. %0 = load %class.A*, %class.A** %a.addr, align 8, !dbg !28
  54. %1 = bitcast %struct.SA* %agg.tmp to i8*, !dbg !28
  55. %2 = bitcast %struct.SA* %sa to i8*, !dbg !28
  56. call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 4, i32 4, i1 false), !dbg !28
  57. %coerce.dive1 = getelementptr %struct.SA, %struct.SA* %agg.tmp, i32 0, i32 0, !dbg !28
  58. %3 = load i32, i32* %coerce.dive1, !dbg !28
  59. call void @_ZN1A5testAE2SA(%class.A* %0, i32 %3), !dbg !28
  60. ret void, !dbg !29
  61. }
  62. ; Function Attrs: nounwind readnone
  63. declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
  64. ; Function Attrs: nounwind ssp uwtable
  65. define linkonce_odr void @_ZN1A5testAE2SA(%class.A* %this, i32 %a.coerce) #2 align 2 {
  66. entry:
  67. %a = alloca %struct.SA, align 4
  68. %this.addr = alloca %class.A*, align 8
  69. %coerce.dive = getelementptr %struct.SA, %struct.SA* %a, i32 0, i32 0
  70. store i32 %a.coerce, i32* %coerce.dive
  71. store %class.A* %this, %class.A** %this.addr, align 8
  72. call void @llvm.dbg.declare(metadata %class.A** %this.addr, metadata !30, metadata !DIExpression()), !dbg !31
  73. call void @llvm.dbg.declare(metadata %struct.SA* %a, metadata !32, metadata !DIExpression()), !dbg !33
  74. %this1 = load %class.A*, %class.A** %this.addr
  75. ret void, !dbg !34
  76. }
  77. ; Function Attrs: nounwind
  78. declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3
  79. 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" }
  80. attributes #1 = { nounwind readnone }
  81. 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" }
  82. attributes #3 = { nounwind }
  83. !llvm.dbg.cu = !{!0}
  84. !llvm.module.flags = !{!21, !22}
  85. !llvm.ident = !{!23}
  86. !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)
  87. !1 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
  88. !2 = !{}
  89. !3 = !{!4, !10}
  90. !4 = !DICompositeType(tag: DW_TAG_class_type, name: "A", line: 5, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1A")
  91. !5 = !{!6}
  92. !6 = !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1A", type: !7)
  93. !7 = !DISubroutineType(types: !8)
  94. !8 = !{null, !9, !"_ZTS2SA"}
  95. !9 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1A")
  96. !10 = !DICompositeType(tag: DW_TAG_structure_type, name: "SA", line: 1, size: 32, align: 32, file: !1, elements: !11, identifier: "_ZTS2SA")
  97. !11 = !{!12}
  98. !12 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !"_ZTS2SA", baseType: !13)
  99. !13 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
  100. !14 = !{!15, !20}
  101. !15 = !DISubprogram(name: "topA", linkageName: "_Z4topAP1A2SA", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 11, file: !1, scope: !16, type: !17, function: void (%class.A*, i32)* @_Z4topAP1A2SA, variables: !2)
  102. !16 = !DIFile(filename: "a.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array")
  103. !17 = !DISubroutineType(types: !18)
  104. !18 = !{null, !19, !"_ZTS2SA"}
  105. !19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1A")
  106. !20 = !DISubprogram(name: "testA", linkageName: "_ZN1A5testAE2SA", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1A", type: !7, function: void (%class.A*, i32)* @_ZN1A5testAE2SA, declaration: !6, variables: !2)
  107. !21 = !{i32 2, !"Dwarf Version", i32 2}
  108. !22 = !{i32 2, !"Debug Info Version", i32 3}
  109. !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"}
  110. !24 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 11, arg: 1, scope: !15, file: !16, type: !19)
  111. !25 = !DILocation(line: 11, column: 14, scope: !15)
  112. !26 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA")
  113. !27 = !DILocation(line: 11, column: 20, scope: !15)
  114. !28 = !DILocation(line: 12, column: 3, scope: !15)
  115. !29 = !DILocation(line: 13, column: 1, scope: !15)
  116. !30 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19)
  117. !31 = !DILocation(line: 0, scope: !20)
  118. !32 = !DILocalVariable(tag: DW_TAG_arg_variable, name: "a", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA")
  119. !33 = !DILocation(line: 7, column: 17, scope: !20)
  120. !34 = !DILocation(line: 8, column: 3, scope: !20)