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
3;
4; Command to generate function-options.ll
5; $ clang++ function-options.cpp -S -emit-llvm -g -gcodeview -o function-options.ll
6;
7;
8; #define DEFINE_FUNCTION(T) \
9;   T Func_##T(T &arg) { return arg; }
10;
11; class AClass {};
12; DEFINE_FUNCTION(AClass); // Expect: FO = None
13;
14; class BClass {
15; private:
16;   explicit BClass(); // Expect ctor: FO = Constructor
17; };
18; DEFINE_FUNCTION(BClass); // Expect: FO = CxxReturnUdt
19;
20; class C1Class {
21; public:
22;   C1Class() = default; // Note: Clang generates one defaulted ctor (FO = None) while MSVC doesn't.
23; };
24; DEFINE_FUNCTION(C1Class); // Expect: FO = None
25;
26; class C2Class { // Note: MSVC-specific dtor, i.e. __vecDelDtor won't be verified in this case.
27; public:
28;   ~C2Class() {} // Expect ~C2Class: FO = None
29; };
30; DEFINE_FUNCTION(C2Class); // Expect: FO = CxxReturnUdt
31;
32; class DClass : public BClass {}; // Note: MSVC yields one compiler-generated ctor for DClass while clang doesn't.
33; DEFINE_FUNCTION(DClass); // Expect: FO = CxxReturnUdt
34;
35; class FClass { static int x; };
36; DEFINE_FUNCTION(FClass); // Expect FO = None
37;
38; struct AStruct {};
39; DEFINE_FUNCTION(AStruct); // Expect FO = None
40;
41; struct BStruct { BStruct(); }; // Expect ctor: FO = Constructor
42; DEFINE_FUNCTION(BStruct); // Expect FO = CxxReturnUdt
43;
44; union AUnion {};
45; DEFINE_FUNCTION(AUnion); // Expect FO = None
46;
47; union BUnion { BUnion() = default; }; // Note: Clang generates one defaulted ctor (FO = None) while MSVC does not.
48; DEFINE_FUNCTION(BUnion); // Expect FO = None
49
50
51; CHECK: Format: COFF-x86-64
52; CHECK: Arch: x86_64
53; CHECK: AddressSize: 64bit
54; CHECK: CodeViewTypes [
55; CHECK:   Section: .debug$T ({{.*}})
56; CHECK:   Magic: 0x4
57; CHECK:   Procedure ([[SP1:.*]]) {
58; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
59; CHECK:     ReturnType: AClass ({{.*}})
60; CHECK:     CallingConvention: NearC (0x0)
61; CHECK:     FunctionOptions [ (0x0)
62; CHECK:     ]
63; CHECK:     NumParameters: 1
64; CHECK:     ArgListType: (AClass&) ({{.*}})
65; CHECK:   }
66; CHECK:   FuncId ({{.*}}) {
67; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
68; CHECK:     ParentScope: 0x0
69; CHECK:     FunctionType: AClass (AClass&) ([[SP1]])
70; CHECK:     Name: Func_AClass
71; CHECK:   }
72; CHECK:   Procedure ([[SP2:.*]]) {
73; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
74; CHECK:     ReturnType: BClass ({{.*}})
75; CHECK:     CallingConvention: NearC (0x0)
76; CHECK:     FunctionOptions [ (0x1)
77; CHECK:       CxxReturnUdt (0x1)
78; CHECK:     ]
79; CHECK:     NumParameters: 1
80; CHECK:     ArgListType: (BClass&) ({{.*}})
81; CHECK:   }
82; CHECK:   MemberFunction ([[MF1:.*]]) {
83; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
84; CHECK:     ReturnType: void (0x3)
85; CHECK:     ClassType: BClass ({{.*}})
86; CHECK:     ThisType: BClass* const ({{.*}})
87; CHECK:     CallingConvention: NearC (0x0)
88; CHECK:     FunctionOptions [ (0x2)
89; CHECK:       Constructor (0x2)
90; CHECK:     ]
91; CHECK:     NumParameters: 0
92; CHECK:     ArgListType: () ({{.*}})
93; CHECK:     ThisAdjustment: 0
94; CHECK:   }
95; CHECK:   FieldList ({{.*}}) {
96; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
97; CHECK:     OneMethod {
98; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
99; CHECK:       AccessSpecifier: Private (0x1)
100; CHECK:       Type: void BClass::() ([[MF1]])
101; CHECK:       Name: BClass
102; CHECK:     }
103; CHECK:   }
104; CHECK:   FuncId ({{.*}}) {
105; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
106; CHECK:     ParentScope: 0x0
107; CHECK:     FunctionType: BClass (BClass&) ([[SP2]])
108; CHECK:     Name: Func_BClass
109; CHECK:   }
110; CHECK:   Procedure ([[SP3:.*]]) {
111; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
112; CHECK:     ReturnType: C1Class ({{.*}})
113; CHECK:     CallingConvention: NearC (0x0)
114; CHECK:     FunctionOptions [ (0x0)
115; CHECK:     ]
116; CHECK:     NumParameters: 1
117; CHECK:     ArgListType: (C1Class&) ({{.*}})
118; CHECK:   }
119; CHECK:   MemberFunction ([[MF2:.*]]) {
120; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
121; CHECK:     ReturnType: void (0x3)
122; CHECK:     ClassType: C1Class ({{.*}})
123; CHECK:     ThisType: C1Class* const ({{.*}})
124; CHECK:     CallingConvention: NearC (0x0)
125; CHECK:     FunctionOptions [ (0x0)
126; CHECK:     ]
127; CHECK:     NumParameters: 0
128; CHECK:     ArgListType: () ({{.*}})
129; CHECK:     ThisAdjustment: 0
130; CHECK:   }
131; CHECK:   FieldList ({{.*}}) {
132; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
133; CHECK:     OneMethod {
134; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
135; CHECK:       AccessSpecifier: Public (0x3)
136; CHECK:       Type: void C1Class::() ([[MF2]])
137; CHECK:       Name: C1Class
138; CHECK:     }
139; CHECK:   }
140; CHECK:   FuncId ({{.*}}) {
141; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
142; CHECK:     ParentScope: 0x0
143; CHECK:     FunctionType: C1Class (C1Class&) ([[SP3]])
144; CHECK:     Name: Func_C1Class
145; CHECK:   }
146; CHECK:   Procedure ([[SP4:.*]]) {
147; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
148; CHECK:     ReturnType: C2Class ({{.*}})
149; CHECK:     CallingConvention: NearC (0x0)
150; CHECK:     FunctionOptions [ (0x1)
151; CHECK:       CxxReturnUdt (0x1)
152; CHECK:     ]
153; CHECK:     NumParameters: 1
154; CHECK:     ArgListType: (C2Class&) ({{.*}})
155; CHECK:   }
156; CHECK:   MemberFunction ([[MF3:.*]]) {
157; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
158; CHECK:     ReturnType: void (0x3)
159; CHECK:     ClassType: C2Class ({{.*}})
160; CHECK:     ThisType: C2Class* const ({{.*}})
161; CHECK:     CallingConvention: NearC (0x0)
162; CHECK:     FunctionOptions [ (0x0)
163; CHECK:     ]
164; CHECK:     NumParameters: 0
165; CHECK:     ArgListType: () ({{.*}})
166; CHECK:     ThisAdjustment: 0
167; CHECK:   }
168; CHECK:   FieldList ({{.*}}) {
169; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
170; CHECK:     OneMethod {
171; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
172; CHECK:       AccessSpecifier: Public (0x3)
173; CHECK:       Type: void C2Class::() ([[MF3]])
174; CHECK:       Name: ~C2Class
175; CHECK:     }
176; CHECK:   }
177; CHECK:   FuncId ({{.*}}) {
178; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
179; CHECK:     ParentScope: 0x0
180; CHECK:     FunctionType: C2Class (C2Class&) ([[SP4]])
181; CHECK:     Name: Func_C2Class
182; CHECK:   }
183; CHECK:   Procedure ([[SP5:.*]]) {
184; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
185; CHECK:     ReturnType: DClass ({{.*}})
186; CHECK:     CallingConvention: NearC (0x0)
187; CHECK:     FunctionOptions [ (0x1)
188; CHECK:       CxxReturnUdt (0x1)
189; CHECK:     ]
190; CHECK:     NumParameters: 1
191; CHECK:     ArgListType: (DClass&) ({{.*}})
192; CHECK:   }
193; CHECK:   FieldList ({{.*}}) {
194; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
195; CHECK:     BaseClass {
196; CHECK:       TypeLeafKind: LF_BCLASS (0x1400)
197; CHECK:       AccessSpecifier: Public (0x3)
198; CHECK:       BaseType: BClass ({{.*}})
199; CHECK:       BaseOffset: 0x0
200; CHECK:     }
201; CHECK:   }
202; CHECK:   FuncId ({{.*}}) {
203; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
204; CHECK:     ParentScope: 0x0
205; CHECK:     FunctionType: DClass (DClass&) ([[SP5]])
206; CHECK:     Name: Func_DClass
207; CHECK:   }
208; CHECK:   Procedure ([[SP6:.*]]) {
209; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
210; CHECK:     ReturnType: FClass ({{.*}})
211; CHECK:     CallingConvention: NearC (0x0)
212; CHECK:     FunctionOptions [ (0x0)
213; CHECK:     ]
214; CHECK:     NumParameters: 1
215; CHECK:     ArgListType: (FClass&) ({{.*}})
216; CHECK:   }
217; CHECK:   FieldList ({{.*}}) {
218; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
219; CHECK:     StaticDataMember {
220; CHECK:       TypeLeafKind: LF_STMEMBER (0x150E)
221; CHECK:       AccessSpecifier: Private (0x1)
222; CHECK:       Type: int (0x74)
223; CHECK:       Name: x
224; CHECK:     }
225; CHECK:   }
226; CHECK:   FuncId ({{.*}}) {
227; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
228; CHECK:     ParentScope: 0x0
229; CHECK:     FunctionType: FClass (FClass&) ([[SP6]])
230; CHECK:     Name: Func_FClass
231; CHECK:   }
232; CHECK:   Procedure ([[SP7:.*]]) {
233; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
234; CHECK:     ReturnType: AStruct ({{.*}})
235; CHECK:     CallingConvention: NearC (0x0)
236; CHECK:     FunctionOptions [ (0x0)
237; CHECK:     ]
238; CHECK:     NumParameters: 1
239; CHECK:     ArgListType: (AStruct&) ({{.*}})
240; CHECK:   }
241; CHECK:   FuncId ({{.*}}) {
242; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
243; CHECK:     ParentScope: 0x0
244; CHECK:     FunctionType: AStruct (AStruct&) ([[SP7]])
245; CHECK:     Name: Func_AStruct
246; CHECK:   }
247; CHECK:   Procedure ([[SP8:.*]]) {
248; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
249; CHECK:     ReturnType: BStruct ({{.*}})
250; CHECK:     CallingConvention: NearC (0x0)
251; CHECK:     FunctionOptions [ (0x1)
252; CHECK:       CxxReturnUdt (0x1)
253; CHECK:     ]
254; CHECK:     NumParameters: 1
255; CHECK:     ArgListType: (BStruct&) ({{.*}})
256; CHECK:   }
257; CHECK:   MemberFunction ([[MF4:.*]]) {
258; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
259; CHECK:     ReturnType: void (0x3)
260; CHECK:     ClassType: BStruct ({{.*}})
261; CHECK:     ThisType: BStruct* const ({{.*}})
262; CHECK:     CallingConvention: NearC (0x0)
263; CHECK:     FunctionOptions [ (0x2)
264; CHECK:       Constructor (0x2)
265; CHECK:     ]
266; CHECK:     NumParameters: 0
267; CHECK:     ArgListType: () ({{.*}})
268; CHECK:     ThisAdjustment: 0
269; CHECK:   }
270; CHECK:   FieldList ({{.*}}) {
271; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
272; CHECK:     OneMethod {
273; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
274; CHECK:       AccessSpecifier: Public (0x3)
275; CHECK:       Type: void BStruct::() ([[MF4]])
276; CHECK:       Name: BStruct
277; CHECK:     }
278; CHECK:   }
279; CHECK:   FuncId ({{.*}}) {
280; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
281; CHECK:     ParentScope: 0x0
282; CHECK:     FunctionType: BStruct (BStruct&) ([[SP8]])
283; CHECK:     Name: Func_BStruct
284; CHECK:   }
285; CHECK:   Procedure ([[SP9:.*]]) {
286; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
287; CHECK:     ReturnType: AUnion ({{.*}})
288; CHECK:     CallingConvention: NearC (0x0)
289; CHECK:     FunctionOptions [ (0x0)
290; CHECK:     ]
291; CHECK:     NumParameters: 1
292; CHECK:     ArgListType: (AUnion&) ({{.*}})
293; CHECK:   }
294; CHECK:   FuncId ({{.*}}) {
295; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
296; CHECK:     ParentScope: 0x0
297; CHECK:     FunctionType: AUnion (AUnion&) ([[SP9]])
298; CHECK:     Name: Func_AUnion
299; CHECK:   }
300; CHECK:   Procedure ([[SP10:.*]]) {
301; CHECK:     TypeLeafKind: LF_PROCEDURE (0x1008)
302; CHECK:     ReturnType: BUnion ({{.*}})
303; CHECK:     CallingConvention: NearC (0x0)
304; CHECK:     FunctionOptions [ (0x0)
305; CHECK:     ]
306; CHECK:     NumParameters: 1
307; CHECK:     ArgListType: (BUnion&) ({{.*}})
308; CHECK:   }
309; CHECK:   MemberFunction ([[MF5:.*]]) {
310; CHECK:     TypeLeafKind: LF_MFUNCTION (0x1009)
311; CHECK:     ReturnType: void (0x3)
312; CHECK:     ClassType: BUnion ({{.*}})
313; CHECK:     ThisType: BUnion* const ({{.*}})
314; CHECK:     CallingConvention: NearC (0x0)
315; CHECK:     FunctionOptions [ (0x0)
316; CHECK:     ]
317; CHECK:     NumParameters: 0
318; CHECK:     ArgListType: () ({{.*}})
319; CHECK:     ThisAdjustment: 0
320; CHECK:   }
321; CHECK:   FieldList ({{.*}}) {
322; CHECK:     TypeLeafKind: LF_FIELDLIST (0x1203)
323; CHECK:     OneMethod {
324; CHECK:       TypeLeafKind: LF_ONEMETHOD (0x1511)
325; CHECK:       AccessSpecifier: Public (0x3)
326; CHECK:       Type: void BUnion::() ([[MF5]])
327; CHECK:       Name: BUnion
328; CHECK:     }
329; CHECK:   }
330; CHECK:   FuncId ({{.*}}) {
331; CHECK:     TypeLeafKind: LF_FUNC_ID (0x1601)
332; CHECK:     ParentScope: 0x0
333; CHECK:     FunctionType: BUnion (BUnion&) ([[SP10]])
334; CHECK:     Name: Func_BUnion
335; CHECK:   }
336; CHECK: ]
337
338
339; ModuleID = 'function-options.cpp'
340source_filename = "function-options.cpp"
341target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
342target triple = "x86_64-pc-windows-msvc19.15.26729"
343
344%class.AClass = type { i8 }
345%class.BClass = type { i8 }
346%class.C1Class = type { i8 }
347%class.C2Class = type { i8 }
348%class.DClass = type { i8 }
349%class.FClass = type { i8 }
350%struct.AStruct = type { i8 }
351%struct.BStruct = type { i8 }
352%union.AUnion = type { i8 }
353%union.BUnion = type { i8 }
354
355; Function Attrs: noinline nounwind optnone uwtable
356define dso_local i8 @"?Func_AClass@@YA?AVAClass@@AEAV1@@Z"(%class.AClass* dereferenceable(1) %arg) #0 !dbg !8 {
357entry:
358  %retval = alloca %class.AClass, align 1
359  %arg.addr = alloca %class.AClass*, align 8
360  store %class.AClass* %arg, %class.AClass** %arg.addr, align 8
361  call void @llvm.dbg.declare(metadata %class.AClass** %arg.addr, metadata !14, metadata !DIExpression()), !dbg !15
362  %0 = load %class.AClass*, %class.AClass** %arg.addr, align 8, !dbg !15
363  %coerce.dive = getelementptr inbounds %class.AClass, %class.AClass* %retval, i32 0, i32 0, !dbg !15
364  %1 = load i8, i8* %coerce.dive, align 1, !dbg !15
365  ret i8 %1, !dbg !15
366}
367
368; Function Attrs: nounwind readnone speculatable
369declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
370
371; Function Attrs: noinline nounwind optnone uwtable
372define dso_local void @"?Func_BClass@@YA?AVBClass@@AEAV1@@Z"(%class.BClass* noalias sret %agg.result, %class.BClass* dereferenceable(1) %arg) #0 !dbg !16 {
373entry:
374  %arg.addr = alloca %class.BClass*, align 8
375  store %class.BClass* %arg, %class.BClass** %arg.addr, align 8
376  call void @llvm.dbg.declare(metadata %class.BClass** %arg.addr, metadata !26, metadata !DIExpression()), !dbg !27
377  %0 = load %class.BClass*, %class.BClass** %arg.addr, align 8, !dbg !27
378  ret void, !dbg !27
379}
380
381; Function Attrs: noinline nounwind optnone uwtable
382define dso_local void @"?Func_C1Class@@YA?AVC1Class@@AEAV1@@Z"(%class.C1Class* noalias sret %agg.result, %class.C1Class* dereferenceable(1) %arg) #0 !dbg !28 {
383entry:
384  %arg.addr = alloca %class.C1Class*, align 8
385  store %class.C1Class* %arg, %class.C1Class** %arg.addr, align 8
386  call void @llvm.dbg.declare(metadata %class.C1Class** %arg.addr, metadata !38, metadata !DIExpression()), !dbg !39
387  %0 = load %class.C1Class*, %class.C1Class** %arg.addr, align 8, !dbg !39
388  ret void, !dbg !39
389}
390
391; Function Attrs: noinline nounwind optnone uwtable
392define dso_local void @"?Func_C2Class@@YA?AVC2Class@@AEAV1@@Z"(%class.C2Class* noalias sret %agg.result, %class.C2Class* dereferenceable(1) %arg) #0 !dbg !40 {
393entry:
394  %arg.addr = alloca %class.C2Class*, align 8
395  store %class.C2Class* %arg, %class.C2Class** %arg.addr, align 8
396  call void @llvm.dbg.declare(metadata %class.C2Class** %arg.addr, metadata !50, metadata !DIExpression()), !dbg !51
397  %0 = load %class.C2Class*, %class.C2Class** %arg.addr, align 8, !dbg !51
398  ret void, !dbg !51
399}
400
401; Function Attrs: noinline nounwind optnone uwtable
402define dso_local void @"?Func_DClass@@YA?AVDClass@@AEAV1@@Z"(%class.DClass* noalias sret %agg.result, %class.DClass* dereferenceable(1) %arg) #0 !dbg !52 {
403entry:
404  %arg.addr = alloca %class.DClass*, align 8
405  store %class.DClass* %arg, %class.DClass** %arg.addr, align 8
406  call void @llvm.dbg.declare(metadata %class.DClass** %arg.addr, metadata !59, metadata !DIExpression()), !dbg !60
407  %0 = load %class.DClass*, %class.DClass** %arg.addr, align 8, !dbg !60
408  ret void, !dbg !60
409}
410
411; Function Attrs: noinline nounwind optnone uwtable
412define dso_local i8 @"?Func_FClass@@YA?AVFClass@@AEAV1@@Z"(%class.FClass* dereferenceable(1) %arg) #0 !dbg !61 {
413entry:
414  %retval = alloca %class.FClass, align 1
415  %arg.addr = alloca %class.FClass*, align 8
416  store %class.FClass* %arg, %class.FClass** %arg.addr, align 8
417  call void @llvm.dbg.declare(metadata %class.FClass** %arg.addr, metadata !69, metadata !DIExpression()), !dbg !70
418  %0 = load %class.FClass*, %class.FClass** %arg.addr, align 8, !dbg !70
419  %coerce.dive = getelementptr inbounds %class.FClass, %class.FClass* %retval, i32 0, i32 0, !dbg !70
420  %1 = load i8, i8* %coerce.dive, align 1, !dbg !70
421  ret i8 %1, !dbg !70
422}
423
424; Function Attrs: noinline nounwind optnone uwtable
425define dso_local i8 @"?Func_AStruct@@YA?AUAStruct@@AEAU1@@Z"(%struct.AStruct* dereferenceable(1) %arg) #0 !dbg !71 {
426entry:
427  %retval = alloca %struct.AStruct, align 1
428  %arg.addr = alloca %struct.AStruct*, align 8
429  store %struct.AStruct* %arg, %struct.AStruct** %arg.addr, align 8
430  call void @llvm.dbg.declare(metadata %struct.AStruct** %arg.addr, metadata !76, metadata !DIExpression()), !dbg !77
431  %0 = load %struct.AStruct*, %struct.AStruct** %arg.addr, align 8, !dbg !77
432  %coerce.dive = getelementptr inbounds %struct.AStruct, %struct.AStruct* %retval, i32 0, i32 0, !dbg !77
433  %1 = load i8, i8* %coerce.dive, align 1, !dbg !77
434  ret i8 %1, !dbg !77
435}
436
437; Function Attrs: noinline nounwind optnone uwtable
438define dso_local void @"?Func_BStruct@@YA?AUBStruct@@AEAU1@@Z"(%struct.BStruct* noalias sret %agg.result, %struct.BStruct* dereferenceable(1) %arg) #0 !dbg !78 {
439entry:
440  %arg.addr = alloca %struct.BStruct*, align 8
441  store %struct.BStruct* %arg, %struct.BStruct** %arg.addr, align 8
442  call void @llvm.dbg.declare(metadata %struct.BStruct** %arg.addr, metadata !88, metadata !DIExpression()), !dbg !89
443  %0 = load %struct.BStruct*, %struct.BStruct** %arg.addr, align 8, !dbg !89
444  ret void, !dbg !89
445}
446
447; Function Attrs: noinline nounwind optnone uwtable
448define dso_local i8 @"?Func_AUnion@@YA?ATAUnion@@AEAT1@@Z"(%union.AUnion* dereferenceable(1) %arg) #0 !dbg !90 {
449entry:
450  %retval = alloca %union.AUnion, align 1
451  %arg.addr = alloca %union.AUnion*, align 8
452  store %union.AUnion* %arg, %union.AUnion** %arg.addr, align 8
453  call void @llvm.dbg.declare(metadata %union.AUnion** %arg.addr, metadata !95, metadata !DIExpression()), !dbg !96
454  %0 = load %union.AUnion*, %union.AUnion** %arg.addr, align 8, !dbg !96
455  %coerce.dive = getelementptr inbounds %union.AUnion, %union.AUnion* %retval, i32 0, i32 0, !dbg !96
456  %1 = load i8, i8* %coerce.dive, align 1, !dbg !96
457  ret i8 %1, !dbg !96
458}
459
460; Function Attrs: noinline nounwind optnone uwtable
461define dso_local void @"?Func_BUnion@@YA?ATBUnion@@AEAT1@@Z"(%union.BUnion* noalias sret %agg.result, %union.BUnion* dereferenceable(1) %arg) #0 !dbg !97 {
462entry:
463  %arg.addr = alloca %union.BUnion*, align 8
464  store %union.BUnion* %arg, %union.BUnion** %arg.addr, align 8
465  call void @llvm.dbg.declare(metadata %union.BUnion** %arg.addr, metadata !107, metadata !DIExpression()), !dbg !108
466  %0 = load %union.BUnion*, %union.BUnion** %arg.addr, align 8, !dbg !108
467  ret void, !dbg !108
468}
469
470attributes #0 = { noinline nounwind optnone uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-frame-pointer-elim"="false" "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"="+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
471attributes #1 = { nounwind readnone speculatable }
472
473!llvm.dbg.cu = !{!0}
474!llvm.module.flags = !{!3, !4, !5, !6}
475!llvm.ident = !{!7}
476
477!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 8.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
478!1 = !DIFile(filename: "function-options.cpp", directory: "\5Ctest\5CDebugInfo\5CCOFF", checksumkind: CSK_MD5, checksum: "e73e74ea0bd81174051f0a4746343e00")
479!2 = !{}
480!3 = !{i32 2, !"CodeView", i32 1}
481!4 = !{i32 2, !"Debug Info Version", i32 3}
482!5 = !{i32 1, !"wchar_size", i32 2}
483!6 = !{i32 7, !"PIC Level", i32 2}
484!7 = !{!"clang version 8.0.0"}
485!8 = distinct !DISubprogram(name: "Func_AClass", linkageName: "?Func_AClass@@YA?AVAClass@@AEAV1@@Z", scope: !9, file: !9, line: 6, type: !10, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
486!9 = !DIFile(filename: "function-options.cpp", directory: "D:\5Cupstream\5Cllvm\5Ctest\5CDebugInfo\5CCOFF")
487!10 = !DISubroutineType(types: !11)
488!11 = !{!12, !13}
489!12 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "AClass", file: !9, line: 5, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?AVAClass@@")
490!13 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !12, size: 64)
491!14 = !DILocalVariable(name: "arg", arg: 1, scope: !8, file: !9, line: 6, type: !13)
492!15 = !DILocation(line: 6, scope: !8)
493!16 = distinct !DISubprogram(name: "Func_BClass", linkageName: "?Func_BClass@@YA?AVBClass@@AEAV1@@Z", scope: !9, file: !9, line: 12, type: !17, isLocal: false, isDefinition: true, scopeLine: 12, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
494!17 = !DISubroutineType(types: !18)
495!18 = !{!19, !25}
496!19 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "BClass", file: !9, line: 8, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !20, identifier: ".?AVBClass@@")
497!20 = !{!21}
498!21 = !DISubprogram(name: "BClass", scope: !19, file: !9, line: 10, type: !22, isLocal: false, isDefinition: false, scopeLine: 10, flags: DIFlagExplicit | DIFlagPrototyped, isOptimized: false)
499!22 = !DISubroutineType(types: !23)
500!23 = !{null, !24}
501!24 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !19, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
502!25 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !19, size: 64)
503!26 = !DILocalVariable(name: "arg", arg: 1, scope: !16, file: !9, line: 12, type: !25)
504!27 = !DILocation(line: 12, scope: !16)
505!28 = distinct !DISubprogram(name: "Func_C1Class", linkageName: "?Func_C1Class@@YA?AVC1Class@@AEAV1@@Z", scope: !9, file: !9, line: 18, type: !29, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
506!29 = !DISubroutineType(types: !30)
507!30 = !{!31, !37}
508!31 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C1Class", file: !9, line: 14, size: 8, flags: DIFlagTypePassByValue, elements: !32, identifier: ".?AVC1Class@@")
509!32 = !{!33}
510!33 = !DISubprogram(name: "C1Class", scope: !31, file: !9, line: 16, type: !34, isLocal: false, isDefinition: false, scopeLine: 16, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)
511!34 = !DISubroutineType(types: !35)
512!35 = !{null, !36}
513!36 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !31, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
514!37 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !31, size: 64)
515!38 = !DILocalVariable(name: "arg", arg: 1, scope: !28, file: !9, line: 18, type: !37)
516!39 = !DILocation(line: 18, scope: !28)
517!40 = distinct !DISubprogram(name: "Func_C2Class", linkageName: "?Func_C2Class@@YA?AVC2Class@@AEAV1@@Z", scope: !9, file: !9, line: 24, type: !41, isLocal: false, isDefinition: true, scopeLine: 24, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
518!41 = !DISubroutineType(types: !42)
519!42 = !{!43, !49}
520!43 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "C2Class", file: !9, line: 20, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !44, identifier: ".?AVC2Class@@")
521!44 = !{!45}
522!45 = !DISubprogram(name: "~C2Class", scope: !43, file: !9, line: 22, type: !46, isLocal: false, isDefinition: false, scopeLine: 22, flags: DIFlagPublic | DIFlagPrototyped, isOptimized: false)
523!46 = !DISubroutineType(types: !47)
524!47 = !{null, !48}
525!48 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !43, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
526!49 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !43, size: 64)
527!50 = !DILocalVariable(name: "arg", arg: 1, scope: !40, file: !9, line: 24, type: !49)
528!51 = !DILocation(line: 24, scope: !40)
529!52 = distinct !DISubprogram(name: "Func_DClass", linkageName: "?Func_DClass@@YA?AVDClass@@AEAV1@@Z", scope: !9, file: !9, line: 27, type: !53, isLocal: false, isDefinition: true, scopeLine: 27, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
530!53 = !DISubroutineType(types: !54)
531!54 = !{!55, !58}
532!55 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "DClass", file: !9, line: 26, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !56, identifier: ".?AVDClass@@")
533!56 = !{!57}
534!57 = !DIDerivedType(tag: DW_TAG_inheritance, scope: !55, baseType: !19, flags: DIFlagPublic, extraData: i32 0)
535!58 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !55, size: 64)
536!59 = !DILocalVariable(name: "arg", arg: 1, scope: !52, file: !9, line: 27, type: !58)
537!60 = !DILocation(line: 27, scope: !52)
538!61 = distinct !DISubprogram(name: "Func_FClass", linkageName: "?Func_FClass@@YA?AVFClass@@AEAV1@@Z", scope: !9, file: !9, line: 30, type: !62, isLocal: false, isDefinition: true, scopeLine: 30, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
539!62 = !DISubroutineType(types: !63)
540!63 = !{!64, !68}
541!64 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "FClass", file: !9, line: 29, size: 8, flags: DIFlagTypePassByValue, elements: !65, identifier: ".?AVFClass@@")
542!65 = !{!66}
543!66 = !DIDerivedType(tag: DW_TAG_member, name: "x", scope: !64, file: !9, line: 29, baseType: !67, flags: DIFlagStaticMember)
544!67 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
545!68 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !64, size: 64)
546!69 = !DILocalVariable(name: "arg", arg: 1, scope: !61, file: !9, line: 30, type: !68)
547!70 = !DILocation(line: 30, scope: !61)
548!71 = distinct !DISubprogram(name: "Func_AStruct", linkageName: "?Func_AStruct@@YA?AUAStruct@@AEAU1@@Z", scope: !9, file: !9, line: 33, type: !72, isLocal: false, isDefinition: true, scopeLine: 33, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
549!72 = !DISubroutineType(types: !73)
550!73 = !{!74, !75}
551!74 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "AStruct", file: !9, line: 32, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?AUAStruct@@")
552!75 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !74, size: 64)
553!76 = !DILocalVariable(name: "arg", arg: 1, scope: !71, file: !9, line: 33, type: !75)
554!77 = !DILocation(line: 33, scope: !71)
555!78 = distinct !DISubprogram(name: "Func_BStruct", linkageName: "?Func_BStruct@@YA?AUBStruct@@AEAU1@@Z", scope: !9, file: !9, line: 36, type: !79, isLocal: false, isDefinition: true, scopeLine: 36, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
556!79 = !DISubroutineType(types: !80)
557!80 = !{!81, !87}
558!81 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "BStruct", file: !9, line: 35, size: 8, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !82, identifier: ".?AUBStruct@@")
559!82 = !{!83}
560!83 = !DISubprogram(name: "BStruct", scope: !81, file: !9, line: 35, type: !84, isLocal: false, isDefinition: false, scopeLine: 35, flags: DIFlagPrototyped, isOptimized: false)
561!84 = !DISubroutineType(types: !85)
562!85 = !{null, !86}
563!86 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !81, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
564!87 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !81, size: 64)
565!88 = !DILocalVariable(name: "arg", arg: 1, scope: !78, file: !9, line: 36, type: !87)
566!89 = !DILocation(line: 36, scope: !78)
567!90 = distinct !DISubprogram(name: "Func_AUnion", linkageName: "?Func_AUnion@@YA?ATAUnion@@AEAT1@@Z", scope: !9, file: !9, line: 39, type: !91, isLocal: false, isDefinition: true, scopeLine: 39, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
568!91 = !DISubroutineType(types: !92)
569!92 = !{!93, !94}
570!93 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "AUnion", file: !9, line: 38, size: 8, flags: DIFlagTypePassByValue, elements: !2, identifier: ".?ATAUnion@@")
571!94 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !93, size: 64)
572!95 = !DILocalVariable(name: "arg", arg: 1, scope: !90, file: !9, line: 39, type: !94)
573!96 = !DILocation(line: 39, scope: !90)
574!97 = distinct !DISubprogram(name: "Func_BUnion", linkageName: "?Func_BUnion@@YA?ATBUnion@@AEAT1@@Z", scope: !9, file: !9, line: 42, type: !98, isLocal: false, isDefinition: true, scopeLine: 42, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
575!98 = !DISubroutineType(types: !99)
576!99 = !{!100, !106}
577!100 = distinct !DICompositeType(tag: DW_TAG_union_type, name: "BUnion", file: !9, line: 41, size: 8, flags: DIFlagTypePassByValue, elements: !101, identifier: ".?ATBUnion@@")
578!101 = !{!102}
579!102 = !DISubprogram(name: "BUnion", scope: !100, file: !9, line: 41, type: !103, isLocal: false, isDefinition: false, scopeLine: 41, flags: DIFlagPrototyped, isOptimized: false)
580!103 = !DISubroutineType(types: !104)
581!104 = !{null, !105}
582!105 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !100, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
583!106 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !100, size: 64)
584!107 = !DILocalVariable(name: "arg", arg: 1, scope: !97, file: !9, line: 42, type: !106)
585!108 = !DILocation(line: 42, scope: !97)
586