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 21 %class.B = type { i8 } 22 %struct.SA = type { i32 } 23 24 ; Function Attrs: ssp uwtable 25 define void @_Z4topBP1B2SA(%class.B* %b, i32 %sa.coerce) #0 { 26 entry: 27 %sa = alloca %struct.SA, align 4 28 %b.addr = alloca %class.B*, align 8 29 %agg.tmp = alloca %struct.SA, align 4 30 %coerce.dive = getelementptr %struct.SA, %struct.SA* %sa, i32 0, i32 0 31 store i32 %sa.coerce, i32* %coerce.dive 32 store %class.B* %b, %class.B** %b.addr, align 8 33 call void @llvm.dbg.declare(metadata %class.B** %b.addr, metadata !24, metadata !MDExpression()), !dbg !25 34 call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !26, metadata !MDExpression()), !dbg !27 35 %0 = load %class.B*, %class.B** %b.addr, align 8, !dbg !28 36 %1 = bitcast %struct.SA* %agg.tmp to i8*, !dbg !28 37 %2 = bitcast %struct.SA* %sa to i8*, !dbg !28 38 call void @llvm.memcpy.p0i8.p0i8.i64(i8* %1, i8* %2, i64 4, i32 4, i1 false), !dbg !28 39 %coerce.dive1 = getelementptr %struct.SA, %struct.SA* %agg.tmp, i32 0, i32 0, !dbg !28 40 %3 = load i32, i32* %coerce.dive1, !dbg !28 41 call void @_ZN1B5testBE2SA(%class.B* %0, i32 %3), !dbg !28 42 ret void, !dbg !29 43 } 44 45 ; Function Attrs: nounwind readnone 46 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 47 48 ; Function Attrs: nounwind ssp uwtable 49 define linkonce_odr void @_ZN1B5testBE2SA(%class.B* %this, i32 %sa.coerce) #2 align 2 { 50 entry: 51 %sa = alloca %struct.SA, align 4 52 %this.addr = alloca %class.B*, align 8 53 %coerce.dive = getelementptr %struct.SA, %struct.SA* %sa, i32 0, i32 0 54 store i32 %sa.coerce, i32* %coerce.dive 55 store %class.B* %this, %class.B** %this.addr, align 8 56 call void @llvm.dbg.declare(metadata %class.B** %this.addr, metadata !30, metadata !MDExpression()), !dbg !31 57 call void @llvm.dbg.declare(metadata %struct.SA* %sa, metadata !32, metadata !MDExpression()), !dbg !33 58 %this1 = load %class.B*, %class.B** %this.addr 59 ret void, !dbg !34 60 } 61 62 ; Function Attrs: nounwind 63 declare void @llvm.memcpy.p0i8.p0i8.i64(i8* nocapture, i8* nocapture readonly, i64, i32, i1) #3 64 65 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" } 66 attributes #1 = { nounwind readnone } 67 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" } 68 attributes #3 = { nounwind } 69 70 !llvm.dbg.cu = !{!0} 71 !llvm.module.flags = !{!21, !22} 72 !llvm.ident = !{!23} 73 74 !0 = !MDCompileUnit(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) 75 !1 = !MDFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") 76 !2 = !{} 77 !3 = !{!4, !10} 78 !4 = !MDCompositeType(tag: DW_TAG_class_type, name: "B", line: 5, size: 8, align: 8, file: !1, elements: !5, identifier: "_ZTS1B") 79 !5 = !{!6} 80 !6 = !MDSubprogram(name: "testB", linkageName: "_ZN1B5testBE2SA", line: 7, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 7, file: !1, scope: !"_ZTS1B", type: !7) 81 !7 = !MDSubroutineType(types: !8) 82 !8 = !{null, !9, !"_ZTS2SA"} 83 !9 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !"_ZTS1B") 84 !10 = !MDCompositeType(tag: DW_TAG_structure_type, name: "SA", line: 1, size: 32, align: 32, file: !1, elements: !11, identifier: "_ZTS2SA") 85 !11 = !{!12} 86 !12 = !MDDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !"_ZTS2SA", baseType: !13) 87 !13 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 88 !14 = !{!15, !20} 89 !15 = !MDSubprogram(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) 90 !16 = !MDFile(filename: "b.cpp", directory: "/Users/manmanren/test-Nov/type_unique/rdar_di_array") 91 !17 = !MDSubroutineType(types: !18) 92 !18 = !{null, !19, !"_ZTS2SA"} 93 !19 = !MDDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, baseType: !"_ZTS1B") 94 !20 = !MDSubprogram(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) 95 !21 = !{i32 2, !"Dwarf Version", i32 2} 96 !22 = !{i32 2, !"Debug Info Version", i32 3} 97 !23 = !{!"clang version 3.5.0 (trunk 214102:214113M) (llvm/trunk 214102:214115M)"} 98 !24 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "b", line: 11, arg: 1, scope: !15, file: !16, type: !19) 99 !25 = !MDLocation(line: 11, column: 14, scope: !15) 100 !26 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 11, arg: 2, scope: !15, file: !16, type: !"_ZTS2SA") 101 !27 = !MDLocation(line: 11, column: 20, scope: !15) 102 !28 = !MDLocation(line: 12, column: 3, scope: !15) 103 !29 = !MDLocation(line: 13, column: 1, scope: !15) 104 !30 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "this", arg: 1, flags: DIFlagArtificial | DIFlagObjectPointer, scope: !20, type: !19) 105 !31 = !MDLocation(line: 0, scope: !20) 106 !32 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "sa", line: 7, arg: 2, scope: !20, file: !16, type: !"_ZTS2SA") 107 !33 = !MDLocation(line: 7, column: 17, scope: !20) 108 !34 = !MDLocation(line: 8, column: 3, scope: !20) 109