1 ; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
2 ; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s
4 ; Command to generate function-options.ll
5 ; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
7 ; #define DEFINE_FUNCTION(T) \
8 ; T Func_##T(T &arg) { return arg; }
11 ; DEFINE_FUNCTION(AClass); // Expect: FO = None
15 ; explicit BClass(); // Expect ctor: FO = Constructor
17 ; DEFINE_FUNCTION(BClass); // Expect: FO = CxxReturnUdt
21 ; C1Class() = default; // Note: Clang generates one defaulted ctor (FO = None) while MSVC doesn't.
23 ; DEFINE_FUNCTION(C1Class); // Expect: FO = None
25 ; class C2Class { // Note: MSVC-specific dtor, i.e. __vecDelDtor won't be verified in this case.
27 ; ~C2Class() {} // Expect ~C2Class: FO = None
29 ; DEFINE_FUNCTION(C2Class); // Expect: FO = CxxReturnUdt
31 ; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
32 ; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
36 ; AClass Member_AClass(AClass &);
37 ; BClass Member_BClass(BClass &);
39 ; DEFINE_FUNCTION(FClass); // Expect FO = None
42 ; DEFINE_FUNCTION(AStruct); // Expect FO = None
44 ; struct BStruct { BStruct(); }; // Expect ctor: FO = Constructor
45 ; DEFINE_FUNCTION(BStruct); // Expect FO = CxxReturnUdt
48 ; DEFINE_FUNCTION(AUnion); // Expect FO = None
50 ; union BUnion { BUnion() = default; }; // Note: Clang generates one defaulted ctor (FO = None) while MSVC does not.
51 ; DEFINE_FUNCTION(BUnion); // Expect FO = None
54 ; CHECK: Format: COFF-x86-64
56 ; CHECK: AddressSize: 64bit
57 ; CHECK: CodeViewTypes [
58 ; CHECK: Section: .debug$T ({{.*}})
60 ; CHECK: Procedure ([[SP_A:.*]]) {
61 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
62 ; CHECK: ReturnType: AClass ({{.*}})
63 ; CHECK: CallingConvention: NearC (0x0)
64 ; CHECK: FunctionOptions [ (0x0)
66 ; CHECK: NumParameters: 1
67 ; CHECK: ArgListType: (AClass&) ({{.*}})
69 ; CHECK: FuncId ({{.*}}) {
70 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
71 ; CHECK: ParentScope: 0x0
72 ; CHECK: FunctionType: AClass (AClass&) ([[SP_A]])
73 ; CHECK: Name: Func_AClass
75 ; CHECK: Procedure ([[SP_B:.*]]) {
76 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
77 ; CHECK: ReturnType: BClass ({{.*}})
78 ; CHECK: CallingConvention: NearC (0x0)
79 ; CHECK: FunctionOptions [ (0x1)
80 ; CHECK: CxxReturnUdt (0x1)
82 ; CHECK: NumParameters: 1
83 ; CHECK: ArgListType: (BClass&) ({{.*}})
85 ; CHECK: MemberFunction ([[CTOR_B:.*]]) {
86 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
87 ; CHECK: ReturnType: void (0x3)
88 ; CHECK: ClassType: BClass ({{.*}})
89 ; CHECK: ThisType: BClass* {{.*}}
90 ; CHECK: CallingConvention: NearC (0x0)
91 ; CHECK: FunctionOptions [ (0x2)
92 ; CHECK: Constructor (0x2)
94 ; CHECK: NumParameters: 0
95 ; CHECK: ArgListType: () ({{.*}})
96 ; CHECK: ThisAdjustment: 0
98 ; CHECK: FieldList ({{.*}}) {
99 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
101 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
102 ; CHECK: AccessSpecifier: Private (0x1)
103 ; CHECK: Type: void BClass::() ([[CTOR_B]])
104 ; CHECK: Name: BClass
107 ; CHECK: FuncId ({{.*}}) {
108 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
109 ; CHECK: ParentScope: 0x0
110 ; CHECK: FunctionType: BClass (BClass&) ([[SP_B]])
111 ; CHECK: Name: Func_BClass
113 ; CHECK: Procedure ([[SP_C1:.*]]) {
114 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
115 ; CHECK: ReturnType: C1Class ({{.*}})
116 ; CHECK: CallingConvention: NearC (0x0)
117 ; CHECK: FunctionOptions [ (0x0)
119 ; CHECK: NumParameters: 1
120 ; CHECK: ArgListType: (C1Class&) ({{.*}})
122 ; CHECK: MemberFunction ([[CTOR_C1:.*]]) {
123 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
124 ; CHECK: ReturnType: void (0x3)
125 ; CHECK: ClassType: C1Class ({{.*}})
126 ; CHECK: ThisType: C1Class* {{.*}}
127 ; CHECK: CallingConvention: NearC (0x0)
128 ; CHECK: FunctionOptions [ (0x0)
130 ; CHECK: NumParameters: 0
131 ; CHECK: ArgListType: () ({{.*}})
132 ; CHECK: ThisAdjustment: 0
134 ; CHECK: FieldList ({{.*}}) {
135 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
137 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
138 ; CHECK: AccessSpecifier: Public (0x3)
139 ; CHECK: Type: void C1Class::() ([[CTOR_C1]])
140 ; CHECK: Name: C1Class
143 ; CHECK: FuncId ({{.*}}) {
144 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
145 ; CHECK: ParentScope: 0x0
146 ; CHECK: FunctionType: C1Class (C1Class&) ([[SP_C1]])
147 ; CHECK: Name: Func_C1Class
149 ; CHECK: Procedure ([[SP_C2:.*]]) {
150 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
151 ; CHECK: ReturnType: C2Class ({{.*}})
152 ; CHECK: CallingConvention: NearC (0x0)
153 ; CHECK: FunctionOptions [ (0x1)
154 ; CHECK: CxxReturnUdt (0x1)
156 ; CHECK: NumParameters: 1
157 ; CHECK: ArgListType: (C2Class&) ({{.*}})
159 ; CHECK: MemberFunction ([[CTOR_C2:.*]]) {
160 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
161 ; CHECK: ReturnType: void (0x3)
162 ; CHECK: ClassType: C2Class ({{.*}})
163 ; CHECK: ThisType: C2Class* {{.*}}
164 ; CHECK: CallingConvention: NearC (0x0)
165 ; CHECK: FunctionOptions [ (0x0)
167 ; CHECK: NumParameters: 0
168 ; CHECK: ArgListType: () ({{.*}})
169 ; CHECK: ThisAdjustment: 0
171 ; CHECK: FieldList ({{.*}}) {
172 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
174 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
175 ; CHECK: AccessSpecifier: Public (0x3)
176 ; CHECK: Type: void C2Class::() ([[CTOR_C2]])
177 ; CHECK: Name: ~C2Class
180 ; CHECK: FuncId ({{.*}}) {
181 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
182 ; CHECK: ParentScope: 0x0
183 ; CHECK: FunctionType: C2Class (C2Class&) ([[SP_C2]])
184 ; CHECK: Name: Func_C2Class
186 ; CHECK: Procedure ([[SP_D:.*]]) {
187 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
188 ; CHECK: ReturnType: DClass ({{.*}})
189 ; CHECK: CallingConvention: NearC (0x0)
190 ; CHECK: FunctionOptions [ (0x1)
191 ; CHECK: CxxReturnUdt (0x1)
193 ; CHECK: NumParameters: 1
194 ; CHECK: ArgListType: (DClass&) ({{.*}})
196 ; CHECK: FieldList ({{.*}}) {
197 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
199 ; CHECK: TypeLeafKind: LF_BCLASS (0x1400)
200 ; CHECK: AccessSpecifier: Public (0x3)
201 ; CHECK: BaseType: BClass ({{.*}})
202 ; CHECK: BaseOffset: 0x0
205 ; CHECK: FuncId ({{.*}}) {
206 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
207 ; CHECK: ParentScope: 0x0
208 ; CHECK: FunctionType: DClass (DClass&) ([[SP_D]])
209 ; CHECK: Name: Func_DClass
211 ; CHECK: Procedure ([[SP_F:.*]]) {
212 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
213 ; CHECK: ReturnType: FClass ({{.*}})
214 ; CHECK: CallingConvention: NearC (0x0)
215 ; CHECK: FunctionOptions [ (0x0)
217 ; CHECK: NumParameters: 1
218 ; CHECK: ArgListType: (FClass&) ({{.*}})
220 ; CHECK: MemberFunction ([[MF_A:.*]]) {
221 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
222 ; CHECK: ReturnType: AClass ({{.*}})
223 ; CHECK: ClassType: FClass ({{.*}})
224 ; CHECK: ThisType: FClass* {{.*}}
225 ; CHECK: CallingConvention: NearC (0x0)
226 ; CHECK: FunctionOptions [ (0x1)
227 ; CHECK: CxxReturnUdt (0x1)
229 ; CHECK: NumParameters: 1
230 ; CHECK: ArgListType: (AClass&) ({{.*}})
231 ; CHECK: ThisAdjustment: 0
233 ; CHECK: MemberFunction ([[MF_B:.*]]) {
234 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
235 ; CHECK: ReturnType: BClass ({{.*}})
236 ; CHECK: ClassType: FClass ({{.*}})
237 ; CHECK: ThisType: FClass* {{.*}}
238 ; CHECK: CallingConvention: NearC (0x0)
239 ; CHECK: FunctionOptions [ (0x1)
240 ; CHECK: CxxReturnUdt (0x1)
242 ; CHECK: NumParameters: 1
243 ; CHECK: ArgListType: (BClass&) ({{.*}})
244 ; CHECK: ThisAdjustment: 0
246 ; CHECK: FieldList ({{.*}}) {
247 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
248 ; CHECK: StaticDataMember {
249 ; CHECK: TypeLeafKind: LF_STMEMBER (0x150E)
250 ; CHECK: AccessSpecifier: Private (0x1)
251 ; CHECK: Type: int (0x74)
255 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
256 ; CHECK: AccessSpecifier: Private (0x1)
257 ; CHECK: Type: AClass FClass::(AClass&) ([[MF_A]])
258 ; CHECK: Name: Member_AClass
261 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
262 ; CHECK: AccessSpecifier: Private (0x1)
263 ; CHECK: Type: BClass FClass::(BClass&) ([[MF_B]])
264 ; CHECK: Name: Member_BClass
267 ; CHECK: FuncId ({{.*}}) {
268 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
269 ; CHECK: ParentScope: 0x0
270 ; CHECK: FunctionType: FClass (FClass&) ([[SP_F]])
271 ; CHECK: Name: Func_FClass
273 ; CHECK: Procedure ([[SP_AS:.*]]) {
274 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
275 ; CHECK: ReturnType: AStruct ({{.*}})
276 ; CHECK: CallingConvention: NearC (0x0)
277 ; CHECK: FunctionOptions [ (0x0)
279 ; CHECK: NumParameters: 1
280 ; CHECK: ArgListType: (AStruct&) ({{.*}})
282 ; CHECK: FuncId ({{.*}}) {
283 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
284 ; CHECK: ParentScope: 0x0
285 ; CHECK: FunctionType: AStruct (AStruct&) ([[SP_AS]])
286 ; CHECK: Name: Func_AStruct
288 ; CHECK: Procedure ([[SP_BS:.*]]) {
289 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
290 ; CHECK: ReturnType: BStruct ({{.*}})
291 ; CHECK: CallingConvention: NearC (0x0)
292 ; CHECK: FunctionOptions [ (0x1)
293 ; CHECK: CxxReturnUdt (0x1)
295 ; CHECK: NumParameters: 1
296 ; CHECK: ArgListType: (BStruct&) ({{.*}})
298 ; CHECK: MemberFunction ([[CTOR_BS:.*]]) {
299 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
300 ; CHECK: ReturnType: void (0x3)
301 ; CHECK: ClassType: BStruct ({{.*}})
302 ; CHECK: ThisType: BStruct* {{.*}}
303 ; CHECK: CallingConvention: NearC (0x0)
304 ; CHECK: FunctionOptions [ (0x2)
305 ; CHECK: Constructor (0x2)
307 ; CHECK: NumParameters: 0
308 ; CHECK: ArgListType: () ({{.*}})
309 ; CHECK: ThisAdjustment: 0
311 ; CHECK: FieldList ({{.*}}) {
312 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
314 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
315 ; CHECK: AccessSpecifier: Public (0x3)
316 ; CHECK: Type: void BStruct::() ([[CTOR_BS]])
317 ; CHECK: Name: BStruct
320 ; CHECK: FuncId ({{.*}}) {
321 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
322 ; CHECK: ParentScope: 0x0
323 ; CHECK: FunctionType: BStruct (BStruct&) ([[SP_BS]])
324 ; CHECK: Name: Func_BStruct
326 ; CHECK: Procedure ([[SP_AU:.*]]) {
327 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
328 ; CHECK: ReturnType: AUnion ({{.*}})
329 ; CHECK: CallingConvention: NearC (0x0)
330 ; CHECK: FunctionOptions [ (0x0)
332 ; CHECK: NumParameters: 1
333 ; CHECK: ArgListType: (AUnion&) ({{.*}})
335 ; CHECK: FuncId ({{.*}}) {
336 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
337 ; CHECK: ParentScope: 0x0
338 ; CHECK: FunctionType: AUnion (AUnion&) ([[SP_AU]])
339 ; CHECK: Name: Func_AUnion
341 ; CHECK: Procedure ([[SP_BU:.*]]) {
342 ; CHECK: TypeLeafKind: LF_PROCEDURE (0x1008)
343 ; CHECK: ReturnType: BUnion ({{.*}})
344 ; CHECK: CallingConvention: NearC (0x0)
345 ; CHECK: FunctionOptions [ (0x0)
347 ; CHECK: NumParameters: 1
348 ; CHECK: ArgListType: (BUnion&) ({{.*}})
350 ; CHECK: MemberFunction ([[CTOR_BU:.*]]) {
351 ; CHECK: TypeLeafKind: LF_MFUNCTION (0x1009)
352 ; CHECK: ReturnType: void (0x3)
353 ; CHECK: ClassType: BUnion ({{.*}})
354 ; CHECK: ThisType: BUnion* {{.*}}
355 ; CHECK: CallingConvention: NearC (0x0)
356 ; CHECK: FunctionOptions [ (0x0)
358 ; CHECK: NumParameters: 0
359 ; CHECK: ArgListType: () ({{.*}})
360 ; CHECK: ThisAdjustment: 0
362 ; CHECK: FieldList ({{.*}}) {
363 ; CHECK: TypeLeafKind: LF_FIELDLIST (0x1203)
365 ; CHECK: TypeLeafKind: LF_ONEMETHOD (0x1511)
366 ; CHECK: AccessSpecifier: Public (0x3)
367 ; CHECK: Type: void BUnion::() ([[CTOR_BU]])
368 ; CHECK: Name: BUnion
371 ; CHECK: FuncId ({{.*}}) {
372 ; CHECK: TypeLeafKind: LF_FUNC_ID (0x1601)
373 ; CHECK: ParentScope: 0x0
374 ; CHECK: FunctionType: BUnion (BUnion&) ([[SP_BU]])
375 ; CHECK: Name: Func_BUnion
380 source_filename = "t.cpp"
381 target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
382 target triple = "x86_64-pc-windows-msvc19.23.28106"
384 %class.AClass = type { i8 }
385 %class.BClass = type { i8 }
386 %class.C1Class = type { i8 }
387 %class.C2Class = type { i8 }
388 %class.DClass = type { i8 }
389 %class.FClass = type { i8 }
390 %struct.AStruct = type { i8 }
391 %struct.BStruct = type { i8 }
392 %union.AUnion = type { i8 }
393 %union.BUnion = type { i8 }
395 ; Function Attrs: noinline nounwind optnone uwtable
396 define dso_local i8 @"?Func_AClass@@YA?AVAClass@@AEAV1@@Z"(%class.AClass* dereferenceable(1) %arg) #0 !dbg !8 {
398 %retval = alloca %class.AClass, align 1
399 %arg.addr = alloca %class.AClass*, align 8
400 store %class.AClass* %arg, %class.AClass** %arg.addr, align 8
401 call void @llvm.dbg.declare(metadata %class.AClass** %arg.addr, metadata !13, metadata !DIExpression()), !dbg !14
402 %0 = load %class.AClass*, %class.AClass** %arg.addr, align 8, !dbg !14
403 %coerce.dive = getelementptr inbounds %class.AClass, %class.AClass* %retval, i32 0, i32 0, !dbg !14
404 %1 = load i8, i8* %coerce.dive, align 1, !dbg !14
408 ; Function Attrs: nounwind readnone speculatable willreturn
409 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
411 ; Function Attrs: noinline nounwind optnone uwtable
412 define dso_local void @"?Func_BClass@@YA?AVBClass@@AEAV1@@Z"(%class.BClass* noalias sret(%class.BClass) %agg.result, %class.BClass* dereferenceable(1) %arg) #0 !dbg !15 {
414 %result.ptr = alloca i8*, align 8
415 %arg.addr = alloca %class.BClass*, align 8
416 %0 = bitcast %class.BClass* %agg.result to i8*
417 store i8* %0, i8** %result.ptr, align 8
418 store %class.BClass* %arg, %class.BClass** %arg.addr, align 8
419 call void @llvm.dbg.declare(metadata %class.BClass** %arg.addr, metadata !25, metadata !DIExpression()), !dbg !26
420 %1 = load %class.BClass*, %class.BClass** %arg.addr, align 8, !dbg !26
424 ; Function Attrs: noinline nounwind optnone uwtable
425 define dso_local void @"?Func_C1Class@@YA?AVC1Class@@AEAV1@@Z"(%class.C1Class* noalias sret(%class.C1Class) %agg.result, %class.C1Class* dereferenceable(1) %arg) #0 !dbg !27 {
427 %result.ptr = alloca i8*, align 8
428 %arg.addr = alloca %class.C1Class*, align 8
429 %0 = bitcast %class.C1Class* %agg.result to i8*
430 store i8* %0, i8** %result.ptr, align 8
431 store %class.C1Class* %arg, %class.C1Class** %arg.addr, align 8
432 call void @llvm.dbg.declare(metadata %class.C1Class** %arg.addr, metadata !37, metadata !DIExpression()), !dbg !38
433 %1 = load %class.C1Class*, %class.C1Class** %arg.addr, align 8, !dbg !38
437 ; Function Attrs: noinline nounwind optnone uwtable
438 define dso_local void @"?Func_C2Class@@YA?AVC2Class@@AEAV1@@Z"(%class.C2Class* noalias sret(%class.C2Class) %agg.result, %class.C2Class* dereferenceable(1) %arg) #0 !dbg !39 {
440 %result.ptr = alloca i8*, align 8
441 %arg.addr = alloca %class.C2Class*, align 8
442 %0 = bitcast %class.C2Class* %agg.result to i8*
443 store i8* %0, i8** %result.ptr, align 8
444 store %class.C2Class* %arg, %class.C2Class** %arg.addr, align 8
445 call void @llvm.dbg.declare(metadata %class.C2Class** %arg.addr, metadata !49, metadata !DIExpression()), !dbg !50
446 %1 = load %class.C2Class*, %class.C2Class** %arg.addr, align 8, !dbg !50
450 ; Function Attrs: noinline nounwind optnone uwtable
451 define dso_local void @"?Func_DClass@@YA?AVDClass@@AEAV1@@Z"(%class.DClass* noalias sret(%class.DClass) %agg.result, %class.DClass* dereferenceable(1) %arg) #0 !dbg !51 {
453 %result.ptr = alloca i8*, align 8
454 %arg.addr = alloca %class.DClass*, align 8
455 %0 = bitcast %class.DClass* %agg.result to i8*
456 store i8* %0, i8** %result.ptr, align 8
457 store %class.DClass* %arg, %class.DClass** %arg.addr, align 8
458 call void @llvm.dbg.declare(metadata %class.DClass** %arg.addr, metadata !58, metadata !DIExpression()), !dbg !59
459 %1 = load %class.DClass*, %class.DClass** %arg.addr, align 8, !dbg !59
463 ; Function Attrs: noinline nounwind optnone uwtable
464 define dso_local i8 @"?Func_FClass@@YA?AVFClass@@AEAV1@@Z"(%class.FClass* dereferenceable(1) %arg) #0 !dbg !60 {
466 %retval = alloca %class.FClass, align 1
467 %arg.addr = alloca %class.FClass*, align 8
468 store %class.FClass* %arg, %class.FClass** %arg.addr, align 8
469 call void @llvm.dbg.declare(metadata %class.FClass** %arg.addr, metadata !75, metadata !DIExpression()), !dbg !76
470 %0 = load %class.FClass*, %class.FClass** %arg.addr, align 8, !dbg !76
471 %coerce.dive = getelementptr inbounds %class.FClass, %class.FClass* %retval, i32 0, i32 0, !dbg !76
472 %1 = load i8, i8* %coerce.dive, align 1, !dbg !76
476 ; Function Attrs: noinline nounwind optnone uwtable
477 define dso_local i8 @"?Func_AStruct@@YA?AUAStruct@@AEAU1@@Z"(%struct.AStruct* dereferenceable(1) %arg) #0 !dbg !77 {
479 %retval = alloca %struct.AStruct, align 1
480 %arg.addr = alloca %struct.AStruct*, align 8
481 store %struct.AStruct* %arg, %struct.AStruct** %arg.addr, align 8
482 call void @llvm.dbg.declare(metadata %struct.AStruct** %arg.addr, metadata !82, metadata !DIExpression()), !dbg !83
483 %0 = load %struct.AStruct*, %struct.AStruct** %arg.addr, align 8, !dbg !83
484 %coerce.dive = getelementptr inbounds %struct.AStruct, %struct.AStruct* %retval, i32 0, i32 0, !dbg !83
485 %1 = load i8, i8* %coerce.dive, align 1, !dbg !83
489 ; Function Attrs: noinline nounwind optnone uwtable
490 define dso_local void @"?Func_BStruct@@YA?AUBStruct@@AEAU1@@Z"(%struct.BStruct* noalias sret(%struct.BStruct) %agg.result, %struct.BStruct* dereferenceable(1) %arg) #0 !dbg !84 {
492 %result.ptr = alloca i8*, align 8
493 %arg.addr = alloca %struct.BStruct*, align 8
494 %0 = bitcast %struct.BStruct* %agg.result to i8*
495 store i8* %0, i8** %result.ptr, align 8
496 store %struct.BStruct* %arg, %struct.BStruct** %arg.addr, align 8
497 call void @llvm.dbg.declare(metadata %struct.BStruct** %arg.addr, metadata !94, metadata !DIExpression()), !dbg !95
498 %1 = load %struct.BStruct*, %struct.BStruct** %arg.addr, align 8, !dbg !95
502 ; Function Attrs: noinline nounwind optnone uwtable
503 define dso_local i8 @"?Func_AUnion@@YA?ATAUnion@@AEAT1@@Z"(%union.AUnion* dereferenceable(1) %arg) #0 !dbg !96 {
505 %retval = alloca %union.AUnion, align 1
506 %arg.addr = alloca %union.AUnion*, align 8
507 store %union.AUnion* %arg, %union.AUnion** %arg.addr, align 8
508 call void @llvm.dbg.declare(metadata %union.AUnion** %arg.addr, metadata !101, metadata !DIExpression()), !dbg !102
509 %0 = load %union.AUnion*, %union.AUnion** %arg.addr, align 8, !dbg !102
510 %coerce.dive = getelementptr inbounds %union.AUnion, %union.AUnion* %retval, i32 0, i32 0, !dbg !102
511 %1 = load i8, i8* %coerce.dive, align 1, !dbg !102
515 ; Function Attrs: noinline nounwind optnone uwtable
516 define dso_local void @"?Func_BUnion@@YA?ATBUnion@@AEAT1@@Z"(%union.BUnion* noalias sret(%union.BUnion) %agg.result, %union.BUnion* dereferenceable(1) %arg) #0 !dbg !103 {
518 %result.ptr = alloca i8*, align 8
519 %arg.addr = alloca %union.BUnion*, align 8
520 %0 = bitcast %union.BUnion* %agg.result to i8*
521 store i8* %0, i8** %result.ptr, align 8
522 store %union.BUnion* %arg, %union.BUnion** %arg.addr, align 8
523 call void @llvm.dbg.declare(metadata %union.BUnion** %arg.addr, metadata !113, metadata !DIExpression()), !dbg !114
524 %1 = load %union.BUnion*, %union.BUnion** %arg.addr, align 8, !dbg !114
528 ; Function Attrs: noinline norecurse nounwind optnone uwtable
529 define dso_local i32 @main() #2 !dbg !115 {
531 %retval = alloca i32, align 4
532 store i32 0, i32* %retval, align 4
536 attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
537 attributes #1 = { nounwind readnone speculatable willreturn }
538 attributes #2 = { noinline norecurse nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
541 !llvm.module.flags = !{!3, !4, !5, !6}
544 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 48992717b0e3466cf8814a188e9568c9d71b59c2)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
545 !1 = !DIFile(filename: "t.cpp", directory: "C:\\src\\tests\\duplicate-types\\llvm-test", checksumkind: CSK_MD5, checksum: "c4c61c0e2135d713d0c99a1ba9ab568b")
547 !3 = !{i32 2, !"CodeView", i32 1}
548 !4 = !{i32 2, !"Debug Info Version", i32 3}
549 !5 = !{i32 1, !"wchar_size", i32 2}
550 !6 = !{i32 7, !"PIC Level", i32 2}
551 !7 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 48992717b0e3466cf8814a188e9568c9d71b59c2)"}
552 !8 = distinct !DISubprogram(name: "Func_AClass", linkageName: "?Func_AClass@@YA?AVAClass@@AEAV1@@Z", scope: !1, file: !1, line: 5, type: !9, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
553 !9 = !DISubroutineType(types: !10)
555 !11 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "AClass", file: !1, line: 4, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?AVAClass@@")
556 !12 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !11, size: 64)
557 !13 = !DILocalVariable(name: "arg", arg: 1, scope: !8, file: !1, line: 5, type: !12)
558 !14 = !DILocation(line: 5, scope: !8)
559 !15 = distinct !DISubprogram(name: "Func_BClass", linkageName: "?Func_BClass@@YA?AVBClass@@AEAV1@@Z", scope: !1, file: !1, line: 11, type: !16, scopeLine: 11, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
560 !16 = !DISubroutineType(types: !17)
562 !18 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "BClass", file: !1, line: 7, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !19, identifier: ".?AVBClass@@")
564 !20 = !DISubprogram(name: "BClass", scope: !18, file: !1, line: 9, type: !21, scopeLine: 9, flags: DIFlagExplicit | DIFlagPrototyped, spFlags: 0)
565 !21 = !DISubroutineType(types: !22)
567 !23 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !18, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
568 !24 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !18, size: 64)
569 !25 = !DILocalVariable(name: "arg", arg: 1, scope: !15, file: !1, line: 11, type: !24)
570 !26 = !DILocation(line: 11, scope: !15)
571 !27 = distinct !DISubprogram(name: "Func_C1Class", linkageName: "?Func_C1Class@@YA?AVC1Class@@AEAV1@@Z", scope: !1, file: !1, line: 17, type: !28, scopeLine: 17, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
572 !28 = !DISubroutineType(types: !29)
574 !30 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C1Class", file: !1, line: 13, size: 8, flags: DIFlagTypePassByValue, elements: !31, identifier: ".?AVC1Class@@")
576 !32 = !DISubprogram(name: "C1Class", scope: !30, file: !1, line: 15, type: !33, scopeLine: 15, flags: DIFlagPublic | DIFlagPrototyped, spFlags: 0)
577 !33 = !DISubroutineType(types: !34)
579 !35 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !30, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
580 !36 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !30, size: 64)
581 !37 = !DILocalVariable(name: "arg", arg: 1, scope: !27, file: !1, line: 17, type: !36)
582 !38 = !DILocation(line: 17, scope: !27)
583 !39 = distinct !DISubprogram(name: "Func_C2Class", linkageName: "?Func_C2Class@@YA?AVC2Class@@AEAV1@@Z", scope: !1, file: !1, line: 23, type: !40, scopeLine: 23, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
584 !40 = !DISubroutineType(types: !41)
586 !42 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C2Class", file: !1, line: 19, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !43, identifier: ".?AVC2Class@@")
588 !44 = !DISubprogram(name: "~C2Class", scope: !42, file: !1, line: 21, type: !45, scopeLine: 21, flags: DIFlagPublic | DIFlagPrototyped, spFlags: 0)
589 !45 = !DISubroutineType(types: !46)
591 !47 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !42, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
592 !48 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !42, size: 64)
593 !49 = !DILocalVariable(name: "arg", arg: 1, scope: !39, file: !1, line: 23, type: !48)
594 !50 = !DILocation(line: 23, scope: !39)
595 !51 = distinct !DISubprogram(name: "Func_DClass", linkageName: "?Func_DClass@@YA?AVDClass@@AEAV1@@Z", scope: !1, file: !1, line: 26, type: !52, scopeLine: 26, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
596 !52 = !DISubroutineType(types: !53)
598 !54 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "DClass", file: !1, line: 25, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !55, identifier: ".?AVDClass@@")
600 !56 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !54, baseType: !18, flags: DIFlagPublic, extraData: i32 0)
601 !57 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !54, size: 64)
602 !58 = !DILocalVariable(name: "arg", arg: 1, scope: !51, file: !1, line: 26, type: !57)
603 !59 = !DILocation(line: 26, scope: !51)
604 !60 = distinct !DISubprogram(name: "Func_FClass", linkageName: "?Func_FClass@@YA?AVFClass@@AEAV1@@Z", scope: !1, file: !1, line: 33, type: !61, scopeLine: 33, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
605 !61 = !DISubroutineType(types: !62)
607 !63 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "FClass", file: !1, line: 28, size: 8, flags: DIFlagTypePassByValue, elements: !64, identifier: ".?AVFClass@@")
608 !64 = !{!65, !67, !71}
609 !65 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !63, file: !1, line: 29, baseType: !66, flags: DIFlagStaticMember)
610 !66 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
611 !67 = !DISubprogram(name: "Member_AClass", linkageName: "?Member_AClass@FClass@@AEAA?AVAClass@@AEAV2@@Z", scope: !63, file: !1, line: 30, type: !68, scopeLine: 30, flags: DIFlagPrototyped, spFlags: 0)
612 !68 = !DISubroutineType(types: !69)
613 !69 = !{!11, !70, !12}
614 !70 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !63, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
615 !71 = !DISubprogram(name: "Member_BClass", linkageName: "?Member_BClass@FClass@@AEAA?AVBClass@@AEAV2@@Z", scope: !63, file: !1, line: 31, type: !72, scopeLine: 31, flags: DIFlagPrototyped, spFlags: 0)
616 !72 = !DISubroutineType(types: !73)
617 !73 = !{!18, !70, !24}
618 !74 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !63, size: 64)
619 !75 = !DILocalVariable(name: "arg", arg: 1, scope: !60, file: !1, line: 33, type: !74)
620 !76 = !DILocation(line: 33, scope: !60)
621 !77 = distinct !DISubprogram(name: "Func_AStruct", linkageName: "?Func_AStruct@@YA?AUAStruct@@AEAU1@@Z", scope: !1, file: !1, line: 36, type: !78, scopeLine: 36, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
622 !78 = !DISubroutineType(types: !79)
624 !80 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AStruct", file: !1, line: 35, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?AUAStruct@@")
625 !81 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !80, size: 64)
626 !82 = !DILocalVariable(name: "arg", arg: 1, scope: !77, file: !1, line: 36, type: !81)
627 !83 = !DILocation(line: 36, scope: !77)
628 !84 = distinct !DISubprogram(name: "Func_BStruct", linkageName: "?Func_BStruct@@YA?AUBStruct@@AEAU1@@Z", scope: !1, file: !1, line: 39, type: !85, scopeLine: 39, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
629 !85 = !DISubroutineType(types: !86)
631 !87 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BStruct", file: !1, line: 38, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !88, identifier: ".?AUBStruct@@")
633 !89 = !DISubprogram(name: "BStruct", scope: !87, file: !1, line: 38, type: !90, scopeLine: 38, flags: DIFlagPrototyped, spFlags: 0)
634 !90 = !DISubroutineType(types: !91)
636 !92 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !87, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
637 !93 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !87, size: 64)
638 !94 = !DILocalVariable(name: "arg", arg: 1, scope: !84, file: !1, line: 39, type: !93)
639 !95 = !DILocation(line: 39, scope: !84)
640 !96 = distinct !DISubprogram(name: "Func_AUnion", linkageName: "?Func_AUnion@@YA?ATAUnion@@AEAT1@@Z", scope: !1, file: !1, line: 42, type: !97, scopeLine: 42, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
641 !97 = !DISubroutineType(types: !98)
643 !99 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "AUnion", file: !1, line: 41, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?ATAUnion@@")
644 !100 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !99, size: 64)
645 !101 = !DILocalVariable(name: "arg", arg: 1, scope: !96, file: !1, line: 42, type: !100)
646 !102 = !DILocation(line: 42, scope: !96)
647 !103 = distinct !DISubprogram(name: "Func_BUnion", linkageName: "?Func_BUnion@@YA?ATBUnion@@AEAT1@@Z", scope: !1, file: !1, line: 45, type: !104, scopeLine: 45, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
648 !104 = !DISubroutineType(types: !105)
650 !106 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "BUnion", file: !1, line: 44, size: 8, flags: DIFlagTypePassByValue, elements: !107, identifier: ".?ATBUnion@@")
652 !108 = !DISubprogram(name: "BUnion", scope: !106, file: !1, line: 44, type: !109, scopeLine: 44, flags: DIFlagPrototyped, spFlags: 0)
653 !109 = !DISubroutineType(types: !110)
655 !111 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !106, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
656 !112 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !106, size: 64)
657 !113 = !DILocalVariable(name: "arg", arg: 1, scope: !103, file: !1, line: 45, type: !112)
658 !114 = !DILocation(line: 45, scope: !103)
659 !115 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 47, type: !116, scopeLine: 47, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
660 !116 = !DISubroutineType(types: !117)
662 !118 = !DILocation(line: 48, scope: !115)