xref: /llvm-project/llvm/test/DebugInfo/COFF/globals.ll (revision 10b03e66629aedad79a804e22d23b575077303b3)
1; RUN: llc < %s | FileCheck %s --check-prefix=ASM
2; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
3; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
4; RUN: llc < %s -filetype=obj | obj2yaml | FileCheck %s --check-prefixes=YAML,YAML-STDOUT
5; RUN: llc < %s -filetype=obj -o %t
6; RUN: obj2yaml < %t | FileCheck %s --check-prefixes=YAML,YAML-FILE
7
8; Repeat with experimental debuginfo iterators:
9; RUN: llc --try-experimental-debuginfo-iterators < %s | FileCheck %s --check-prefix=ASM
10; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
11; RUN: llc --try-experimental-debuginfo-iterators < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
12; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj | obj2yaml | FileCheck %s --check-prefixes=YAML,YAML-STDOUT
13; RUN: llc --try-experimental-debuginfo-iterators < %s -filetype=obj -o %t
14; RUN: obj2yaml < %t | FileCheck %s --check-prefixes=YAML,YAML-FILE
15
16; C++ source to regenerate:
17; $ cat a.cpp
18; int first;
19;
20; template <typename T> struct A { static const int comdat = 3; };
21;
22; thread_local const int *middle = &A<void>::comdat;
23;
24; namespace foo {
25; thread_local int globalTLS = 4;
26; static thread_local int staticTLS = 5;
27; int justGlobal = 6;
28; static int globalStatic = 7;
29; constexpr int constExpr = 8;
30; const int constVal = 9;
31;
32; struct Data {
33;   inline static thread_local int DataStaticTLS = 11;
34;   int DataGlobal = 12;
35;   inline static int DataStatic = 13;
36;   constexpr static int DataConstExpr = 14;
37;   const int DataConstVal = 15;
38; };
39; } // namespace foo
40;
41; int last;
42;
43; int bar() {
44;   struct Local {
45;     int LocalGlobal = 12;
46;     const int LocalConstVal = 15;
47;   };
48;   foo::Data D;
49;   Local L;
50;   return foo::globalStatic + foo::globalTLS + foo::staticTLS + foo::justGlobal +
51;          foo::globalStatic + foo::constExpr + foo::constVal + D.DataStaticTLS +
52;          D.DataGlobal + D.DataStatic + D.DataConstExpr + D.DataConstVal +
53;          L.LocalGlobal + L.LocalConstVal;
54; }
55;
56; $ clang-cl a.cpp /c /GS- /Z7 /GR- /std:c++17 /clang:-S /clang:-emit-llvm
57
58; ASM:        .section        .debug$S,"dr"
59; ASM-NEXT:   .p2align        2, 0x0
60; ASM-NEXT:   .long   4                       # Debug section magic
61
62; ASM:        .short  4365                    # Record kind: S_GDATA32
63; ASM-NEXT:   .long   116                     # Type
64; ASM-NEXT:   .secrel32       "?first@@3HA"   # DataOffset
65; ASM-NEXT:   .secidx "?first@@3HA"           # Segment
66; ASM-NEXT:   .asciz  "first"                 # Name
67; ASM-NEXT:   .p2align        2, 0x0
68
69; ASM:        .short  4371                    # Record kind: S_GTHREAD32
70; ASM-NEXT:   .long   4117                    # Type
71; ASM-NEXT:   .secrel32       "?middle@@3PEBHEB" # DataOffset
72; ASM-NEXT:   .secidx "?middle@@3PEBHEB"      # Segment
73; ASM-NEXT:   .asciz  "middle"                # Name
74; ASM-NEXT:   .p2align        2, 0x0
75
76; ASM:        .short  4371                    # Record kind: S_GTHREAD32
77; ASM-NEXT:   .long   116                     # Type
78; ASM-NEXT:   .secrel32       "?globalTLS@foo@@3HA" # DataOffset
79; ASM-NEXT:   .secidx "?globalTLS@foo@@3HA"   # Segment
80; ASM-NEXT:   .asciz  "foo::globalTLS"        # Name
81; ASM-NEXT:   .p2align        2, 0x0
82
83; ASM:        .short  4365                    # Record kind: S_GDATA32
84; ASM-NEXT:   .long   116                     # Type
85; ASM-NEXT:   .secrel32       "?justGlobal@foo@@3HA" # DataOffset
86; ASM-NEXT:   .secidx "?justGlobal@foo@@3HA"  # Segment
87; ASM-NEXT:   .asciz  "foo::justGlobal"       # Name
88; ASM-NEXT:   .p2align        2, 0x0
89
90; ASM:        .short  4365                    # Record kind: S_GDATA32
91; ASM-NEXT:   .long   116                     # Type
92; ASM-NEXT:   .secrel32       "?last@@3HA"    # DataOffset
93; ASM-NEXT:   .secidx "?last@@3HA"            # Segment
94; ASM-NEXT:   .asciz  "last"                  # Name
95; ASM-NEXT:   .p2align        2, 0x0
96
97; ASM:        .short	4359                    # Record kind: S_CONSTANT
98; ASM-NEXT:	  .long	4100                    # Type
99; ASM-NEXT:   .byte	0x08, 0x00              # Value
100; ASM-NEXT:	  .asciz	"foo::constExpr"        # Name
101; ASM-NEXT:   .p2align	2, 0x0
102
103; ASM:        .short	4359                    # Record kind: S_CONSTANT
104; ASM-NEXT:   .long	4100                    # Type
105; ASM-NEXT:   .byte	0x09, 0x00              # Value
106; ASM-NEXT:   .asciz	"foo::constVal"         # Name
107; ASM-NEXT:   .p2align	2, 0x0
108
109; ASM:        .short	4359                    # Record kind: S_CONSTANT
110; ASM-NEXT:   .long	4100                    # Type
111; ASM-NEXT:   .byte	0x0e, 0x00              # Value
112; ASM-NEXT:   .asciz	"foo::Data::DataConstExpr" # Name
113; ASM-NEXT:   .p2align	2, 0x0
114
115; ASM:        .short  4364                    # Record kind: S_LDATA32
116; ASM-NEXT:   .long   116                     # Type
117; ASM-NEXT:   .secrel32       "?globalStatic@foo@@3HA" # DataOffset
118; ASM-NEXT:   .secidx "?globalStatic@foo@@3HA" # Segment
119; ASM-NEXT:   .asciz  "foo::globalStatic"     # Name
120; ASM-NEXT:   .p2align        2, 0x0
121
122; ASM:        .short  4370                    # Record kind: S_LTHREAD32
123; ASM-NEXT:   .long   116                     # Type
124; ASM-NEXT:   .secrel32       "?staticTLS@foo@@3HA" # DataOffset
125; ASM-NEXT:   .secidx "?staticTLS@foo@@3HA"   # Segment
126; ASM-NEXT:   .asciz  "foo::staticTLS"        # Name
127; ASM-NEXT:   .p2align        2, 0x0
128
129; ASM:        .section        .debug$S,"dr",associative,"?comdat@?$A@X@@2HB"
130; ASM-NEXT:   .p2align        2, 0x0
131; ASM-NEXT:   .long   4                       # Debug section magic
132
133; ASM:        .short  4365                    # Record kind: S_GDATA32
134; ASM-NEXT:   .long   4100                    # Type
135; ASM-NEXT:   .secrel32       "?comdat@?$A@X@@2HB" # DataOffset
136; ASM-NEXT:   .secidx "?comdat@?$A@X@@2HB"    # Segment
137; ASM-NEXT:   .asciz  "A<void>::comdat"       # Name
138
139; ASM:	      .section	.debug$S,"dr",associative,"?DataStaticTLS@Data@foo@@2HA"
140; ASM-NEXT:	  .p2align	2, 0x0          # Symbol subsection for ?DataStaticTLS@Data@foo@@2HA
141
142; ASM:	      .short	4371                    # Record kind: S_GTHREAD32
143; ASM-NEXT:	  .long	116                     # Type
144; ASM-NEXT:	  .secrel32	"?DataStaticTLS@Data@foo@@2HA" # DataOffset
145; ASM-NEXT:	  .secidx	"?DataStaticTLS@Data@foo@@2HA" # Segment
146; ASM-NEXT:	  .asciz	"foo::Data::DataStaticTLS"         # Name
147; ASM-NEXT:   .p2align	2, 0x0
148
149; ASM:        .section        .debug$S,"dr",associative,"?DataStatic@Data@foo@@2HA"
150; ASM-NEXT:   .p2align        2, 0x0          # Symbol subsection for ?DataStatic@Data@foo@@2HA
151
152; ASM:        .short  4365                    # Record kind: S_GDATA32
153; ASM-NEXT:   .long   116                     # Type
154; ASM-NEXT:   .secrel32       "?DataStatic@Data@foo@@2HA" # DataOffset
155; ASM-NEXT:   .secidx "?DataStatic@Data@foo@@2HA" # Segment
156; ASM-NEXT:   .asciz  "foo::Data::DataStatic" # Name
157; ASM-NEXT:   .p2align        2, 0x0
158
159; OBJ: CodeViewDebugInfo [
160; OBJ:   Section: .debug$S
161; OBJ:   Magic: 0x4
162; OBJ:   Subsection [
163
164; OBJ-LABEL:    GlobalData {
165; OBJ-NEXT:       Kind: S_GDATA32 (0x110D)
166; OBJ-NEXT:       DataOffset: ?first@@3HA+0x0
167; OBJ-NEXT:       Type: int (0x74)
168; OBJ-NEXT:       DisplayName: first
169; OBJ-NEXT:       LinkageName: ?first@@3HA
170; OBJ-NEXT:     }
171; OBJ-NEXT:     GlobalTLS {
172; OBJ-NEXT:       Kind: S_GTHREAD32 (0x1113)
173; OBJ-NEXT:       DataOffset: ?middle@@3PEBHEB+0x0
174; OBJ-NEXT:       Type: const int* (0x1015)
175; OBJ-NEXT:       DisplayName: middle
176; OBJ-NEXT:       LinkageName: ?middle@@3PEBHEB
177; OBJ-NEXT:     }
178; OBJ-NEXT:     GlobalTLS {
179; OBJ-NEXT:       Kind: S_GTHREAD32 (0x1113)
180; OBJ-NEXT:       DataOffset: ?globalTLS@foo@@3HA+0x0
181; OBJ-NEXT:       Type: int (0x74)
182; OBJ-NEXT:       DisplayName: foo::globalTLS
183; OBJ-NEXT:       LinkageName: ?globalTLS@foo@@3HA
184; OBJ-NEXT:     }
185; OBJ-NEXT:     GlobalData {
186; OBJ-NEXT:       Kind: S_GDATA32 (0x110D)
187; OBJ-NEXT:       DataOffset: ?justGlobal@foo@@3HA+0x0
188; OBJ-NEXT:       Type: int (0x74)
189; OBJ-NEXT:       DisplayName: foo::justGlobal
190; OBJ-NEXT:       LinkageName: ?justGlobal@foo@@3HA
191; OBJ-NEXT:     }
192; OBJ-NEXT:     GlobalData {
193; OBJ-NEXT:       Kind: S_GDATA32 (0x110D)
194; OBJ-NEXT:       DataOffset: ?last@@3HA+0x0
195; OBJ-NEXT:       Type: int (0x74)
196; OBJ-NEXT:       DisplayName: last
197; OBJ-NEXT:       LinkageName: ?last@@3HA
198; OBJ-NEXT:     }
199; OBJ-NEXT:    ConstantSym {
200; OBJ-NEXT:      Kind: S_CONSTANT (0x1107)
201; OBJ-NEXT:      Type: const int (0x1004)
202; OBJ-NEXT:      Value: 8
203; OBJ-NEXT:      Name: foo::constExpr
204; OBJ-NEXT:    }
205; OBJ-NEXT:    ConstantSym {
206; OBJ-NEXT:      Kind: S_CONSTANT (0x1107)
207; OBJ-NEXT:      Type: const int (0x1004)
208; OBJ-NEXT:      Value: 9
209; OBJ-NEXT:      Name: foo::constVal
210; OBJ-NEXT:    }
211; OBJ-NEXT:    ConstantSym {
212; OBJ-NEXT:      Kind: S_CONSTANT (0x1107)
213; OBJ-NEXT:      Type: const int (0x1004)
214; OBJ-NEXT:      Value: 14
215; OBJ-NEXT:      Name: foo::Data::DataConstExpr
216; OBJ-NEXT:    }
217; OBJ-NEXT:     DataSym {
218; OBJ-NEXT:       Kind: S_LDATA32 (0x110C)
219; OBJ-NEXT:       DataOffset: ?globalStatic@foo@@3HA+0x0
220; OBJ-NEXT:       Type: int (0x74)
221; OBJ-NEXT:       DisplayName: foo::globalStatic
222; OBJ-NEXT:       LinkageName: ?globalStatic@foo@@3HA
223; OBJ-NEXT:     }
224; OBJ-NEXT:     ThreadLocalDataSym {
225; OBJ-NEXT:       Kind: S_LTHREAD32 (0x1112)
226; OBJ-NEXT:       DataOffset: ?staticTLS@foo@@3HA+0x0
227; OBJ-NEXT:       Type: int (0x74)
228; OBJ-NEXT:       DisplayName: foo::staticTLS
229; OBJ-NEXT:       LinkageName: ?staticTLS@foo@@3HA
230; OBJ-NEXT:     }
231
232; OBJ:    GlobalData {
233; OBJ-NEXT:      Kind: S_GDATA32 (0x110D)
234; OBJ-LABEL:      DataOffset: ?comdat@?$A@X@@2HB+0x0
235; OBJ-NEXT:      Type: const int (0x1004)
236; OBJ-NEXT:      DisplayName: A<void>::comdat
237; OBJ-NEXT:      LinkageName: ?comdat@?$A@X@@2HB
238
239; OBJ:    GlobalTLS {
240; OBJ-NEXT:      Kind: S_GTHREAD32 (0x1113)
241; OBJ-NEXT:      DataOffset: ?DataStaticTLS@Data@foo@@2HA+0x0
242; OBJ-NEXT:      Type: int (0x74)
243; OBJ-NEXT:      DisplayName: foo::Data::DataStaticTLS
244; OBJ-NEXT:      LinkageName: ?DataStaticTLS@Data@foo@@2HA
245; OBJ-NEXT:    }
246
247; OBJ:    GlobalData {
248; OBJ-NEXT:      Kind: S_GDATA32 (0x110D)
249; OBJ-NEXT:      DataOffset: ?DataStatic@Data@foo@@2HA+0x0
250; OBJ-NEXT:      Type: int (0x74)
251; OBJ-NEXT:      DisplayName: foo::Data::DataStatic
252; OBJ-NEXT:      LinkageName: ?DataStatic@Data@foo@@2HA
253; OBJ-NEXT:    }
254
255; YAML-LABEL:  - Name:            '.debug$S'
256; YAML:    Subsections:
257; YAML:      - !Symbols
258; YAML:        Records:
259; YAML:          - Kind:            S_OBJNAME
260; YAML:            ObjNameSym:
261; YAML:               Signature:       0
262; YAML-STDOUT:        ObjectName:      ''
263; YAML-FILE:          ObjectName:      '{{.*}}'
264; YAML:          - Kind:            S_COMPILE3
265; YAML:            Compile3Sym:
266
267; YAML:      - !Symbols
268; YAML-NEXT:        Records:
269; YAML-LABEL:        - Kind:            S_GDATA32
270; YAML-NEXT:            DataSym:
271; YAML-NOT: Segment
272; YAML-NEXT:              Type:            116
273; YAML-NOT: Segment
274; YAML-NEXT:              DisplayName:     first
275; YAML-NOT: Segment
276; YAML-NEXT:          - Kind:            S_GTHREAD32
277; YAML-NEXT:            ThreadLocalDataSym:
278; YAML-NEXT:              Type:            4117
279; YAML-NEXT:              DisplayName:     middle
280; YAML-NEXT:          - Kind:            S_GTHREAD32
281; YAML-NEXT:            ThreadLocalDataSym:
282; YAML-NEXT:              Type:            116
283; YAML-NEXT:              DisplayName:     'foo::globalTLS'
284; YAML-NEXT:          - Kind:            S_GDATA32
285; YAML-NEXT:            DataSym:
286; YAML-NOT: Segment
287; YAML-NEXT:              Type:            116
288; YAML-NOT: Segment
289; YAML-NEXT:              DisplayName:     'foo::justGlobal'
290; YAML-NOT: Segment
291; YAML-NEXT:          - Kind:            S_GDATA32
292; YAML-NEXT:            DataSym:
293; YAML-NEXT:              Type:            116
294; YAML-NEXT:              DisplayName:     last
295; YAML-NEXT:          - Kind:            S_CONSTANT
296; YAML-NEXT:            ConstantSym:
297; YAML-NEXT:              Type:            4100
298; YAML-NEXT:              Value:           8
299; YAML-NEXT:              Name:            'foo::constExpr'
300; YAML-NEXT:          - Kind:            S_CONSTANT
301; YAML-NEXT:            ConstantSym:
302; YAML-NEXT:              Type:            4100
303; YAML-NEXT:              Value:           9
304; YAML-NEXT:              Name:            'foo::constVal'
305; YAML-NEXT:          - Kind:            S_CONSTANT
306; YAML-NEXT:            ConstantSym:
307; YAML-NEXT:              Type:            4100
308; YAML-NEXT:              Value:           14
309; YAML-NEXT:              Name:            'foo::Data::DataConstExpr'
310; YAML-NEXT:          - Kind:            S_LDATA32
311; YAML-NEXT:            DataSym:
312; YAML-NEXT:              Type:            116
313; YAML-NEXT:              DisplayName:     'foo::globalStatic'
314; YAML-NEXT:          - Kind:            S_LTHREAD32
315; YAML-NEXT:            ThreadLocalDataSym:
316; YAML-NEXT:              Type:            116
317; YAML-NEXT:              DisplayName:     'foo::staticTLS'
318
319; ModuleID = 'a.cpp'
320source_filename = "a.cpp"
321target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
322target triple = "x86_64-pc-windows-msvc19.25.28614"
323
324%"struct.foo::Data" = type { i32, i32 }
325%struct.Local = type { i32, i32 }
326
327$"??0Data@foo@@QEAA@XZ" = comdat any
328
329$"?comdat@?$A@X@@2HB" = comdat any
330
331$"?DataStaticTLS@Data@foo@@2HA" = comdat any
332
333$"?DataStatic@Data@foo@@2HA" = comdat any
334
335@"?first@@3HA" = dso_local global i32 0, align 4, !dbg !0
336@"?comdat@?$A@X@@2HB" = linkonce_odr dso_local constant i32 3, comdat, align 4, !dbg !17
337@"?middle@@3PEBHEB" = dso_local thread_local global ptr @"?comdat@?$A@X@@2HB", align 8, !dbg !24
338@"?globalTLS@foo@@3HA" = dso_local thread_local global i32 4, align 4, !dbg !27
339@"?justGlobal@foo@@3HA" = dso_local global i32 6, align 4, !dbg !29
340@"?last@@3HA" = dso_local global i32 0, align 4, !dbg !31
341@"?globalStatic@foo@@3HA" = internal global i32 7, align 4, !dbg !43
342@"?staticTLS@foo@@3HA" = internal thread_local global i32 5, align 4, !dbg !45
343@"?DataStaticTLS@Data@foo@@2HA" = linkonce_odr dso_local thread_local global i32 11, comdat, align 4, !dbg !37
344@"?DataStatic@Data@foo@@2HA" = linkonce_odr dso_local global i32 13, comdat, align 4, !dbg !39
345
346; Function Attrs: noinline nounwind optnone uwtable
347define dso_local i32 @"?bar@@YAHXZ"() #0 !dbg !54 {
348entry:
349  %D = alloca %"struct.foo::Data", align 4
350  %L = alloca %struct.Local, align 4
351  call void @llvm.dbg.declare(metadata ptr %D, metadata !57, metadata !DIExpression()), !dbg !58
352  %call = call ptr @"??0Data@foo@@QEAA@XZ"(ptr %D) #2, !dbg !58
353  call void @llvm.dbg.declare(metadata ptr %L, metadata !59, metadata !DIExpression()), !dbg !64
354  %call1 = call ptr @"??0Local@?1??bar@@YAHXZ@QEAA@XZ"(ptr %L) #2, !dbg !64
355  %0 = load i32, ptr @"?globalStatic@foo@@3HA", align 4, !dbg !65
356  %1 = load i32, ptr @"?globalTLS@foo@@3HA", align 4, !dbg !65
357  %add = add nsw i32 %0, %1, !dbg !65
358  %2 = load i32, ptr @"?staticTLS@foo@@3HA", align 4, !dbg !65
359  %add2 = add nsw i32 %add, %2, !dbg !65
360  %3 = load i32, ptr @"?justGlobal@foo@@3HA", align 4, !dbg !65
361  %add3 = add nsw i32 %add2, %3, !dbg !65
362  %4 = load i32, ptr @"?globalStatic@foo@@3HA", align 4, !dbg !65
363  %add4 = add nsw i32 %add3, %4, !dbg !65
364  %add5 = add nsw i32 %add4, 8, !dbg !65
365  %add6 = add nsw i32 %add5, 9, !dbg !65
366  %5 = load i32, ptr @"?DataStaticTLS@Data@foo@@2HA", align 4, !dbg !65
367  %add7 = add nsw i32 %add6, %5, !dbg !65
368  %6 = load i32, ptr %D, align 4, !dbg !65
369  %add8 = add nsw i32 %add7, %6, !dbg !65
370  %7 = load i32, ptr @"?DataStatic@Data@foo@@2HA", align 4, !dbg !65
371  %add9 = add nsw i32 %add8, %7, !dbg !65
372  %add10 = add nsw i32 %add9, 14, !dbg !65
373  %DataConstVal = getelementptr inbounds %"struct.foo::Data", ptr %D, i32 0, i32 1, !dbg !65
374  %8 = load i32, ptr %DataConstVal, align 4, !dbg !65
375  %add11 = add nsw i32 %add10, %8, !dbg !65
376  %9 = load i32, ptr %L, align 4, !dbg !65
377  %add12 = add nsw i32 %add11, %9, !dbg !65
378  %LocalConstVal = getelementptr inbounds %struct.Local, ptr %L, i32 0, i32 1, !dbg !65
379  %10 = load i32, ptr %LocalConstVal, align 4, !dbg !65
380  %add13 = add nsw i32 %add12, %10, !dbg !65
381  ret i32 %add13, !dbg !65
382}
383
384; Function Attrs: nounwind readnone speculatable willreturn
385declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
386
387; Function Attrs: noinline nounwind optnone uwtable
388define linkonce_odr dso_local ptr @"??0Data@foo@@QEAA@XZ"(ptr returned %this) unnamed_addr #0 comdat align 2 !dbg !66 {
389entry:
390  %this.addr = alloca ptr, align 8
391  store ptr %this, ptr %this.addr, align 8
392  call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !71, metadata !DIExpression()), !dbg !73
393  %this1 = load ptr, ptr %this.addr, align 8
394  store i32 12, ptr %this1, align 4, !dbg !74
395  %DataConstVal = getelementptr inbounds %"struct.foo::Data", ptr %this1, i32 0, i32 1, !dbg !74
396  store i32 15, ptr %DataConstVal, align 4, !dbg !74
397  ret ptr %this1, !dbg !74
398}
399
400; Function Attrs: noinline nounwind optnone uwtable
401define internal ptr @"??0Local@?1??bar@@YAHXZ@QEAA@XZ"(ptr returned %this) unnamed_addr #0 align 2 !dbg !75 {
402entry:
403  %this.addr = alloca ptr, align 8
404  store ptr %this, ptr %this.addr, align 8
405  call void @llvm.dbg.declare(metadata ptr %this.addr, metadata !80, metadata !DIExpression()), !dbg !82
406  %this1 = load ptr, ptr %this.addr, align 8
407  store i32 12, ptr %this1, align 4, !dbg !83
408  %LocalConstVal = getelementptr inbounds %struct.Local, ptr %this1, i32 0, i32 1, !dbg !83
409  store i32 15, ptr %LocalConstVal, align 4, !dbg !83
410  ret ptr %this1, !dbg !83
411}
412
413attributes #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" }
414attributes #1 = { nounwind readnone speculatable willreturn }
415attributes #2 = { nounwind }
416
417!llvm.dbg.cu = !{!2}
418!llvm.linker.options = !{!47, !48}
419!llvm.module.flags = !{!49, !50, !51, !52}
420!llvm.ident = !{!53}
421
422!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
423!1 = distinct !DIGlobalVariable(name: "first", linkageName: "?first@@3HA", scope: !2, file: !3, line: 1, type: !10, isLocal: false, isDefinition: true)
424!2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !16, nameTableKind: None)
425!3 = !DIFile(filename: "a.cpp", directory: "F:\\llvm-project\\__test", checksumkind: CSK_MD5, checksum: "ae8137877dbd6fb10cfa1fc9ea4a39ca")
426!4 = !{}
427!5 = !{!6}
428!6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Data", scope: !7, file: !3, line: 15, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !8, identifier: ".?AUData@foo@@")
429!7 = !DINamespace(name: "foo", scope: null)
430!8 = !{!9, !11, !12, !13, !15}
431!9 = !DIDerivedType(tag: DW_TAG_member, name: "DataStaticTLS", scope: !6, file: !3, line: 16, baseType: !10, flags: DIFlagStaticMember, extraData: i32 11)
432!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
433!11 = !DIDerivedType(tag: DW_TAG_member, name: "DataGlobal", scope: !6, file: !3, line: 17, baseType: !10, size: 32)
434!12 = !DIDerivedType(tag: DW_TAG_member, name: "DataStatic", scope: !6, file: !3, line: 18, baseType: !10, flags: DIFlagStaticMember, extraData: i32 13)
435!13 = !DIDerivedType(tag: DW_TAG_member, name: "DataConstExpr", scope: !6, file: !3, line: 19, baseType: !14, flags: DIFlagStaticMember, extraData: i32 14)
436!14 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !10)
437!15 = !DIDerivedType(tag: DW_TAG_member, name: "DataConstVal", scope: !6, file: !3, line: 20, baseType: !14, size: 32, offset: 32)
438!16 = !{!0, !17, !24, !27, !29, !31, !33, !35, !37, !39, !41, !43, !45}
439!17 = !DIGlobalVariableExpression(var: !18, expr: !DIExpression())
440!18 = distinct !DIGlobalVariable(name: "comdat", linkageName: "?comdat@?$A@X@@2HB", scope: !2, file: !3, line: 3, type: !14, isLocal: false, isDefinition: true, declaration: !19)
441!19 = !DIDerivedType(tag: DW_TAG_member, name: "comdat", scope: !20, file: !3, line: 3, baseType: !14, flags: DIFlagStaticMember, extraData: i32 3)
442!20 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "A<void>", file: !3, line: 3, size: 8, flags: DIFlagTypePassByValue, elements: !21, templateParams: !22, identifier: ".?AU?$A@X@@")
443!21 = !{!19}
444!22 = !{!23}
445!23 = !DITemplateTypeParameter(name: "T", type: null)
446!24 = !DIGlobalVariableExpression(var: !25, expr: !DIExpression())
447!25 = distinct !DIGlobalVariable(name: "middle", linkageName: "?middle@@3PEBHEB", scope: !2, file: !3, line: 5, type: !26, isLocal: false, isDefinition: true)
448!26 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !14, size: 64)
449!27 = !DIGlobalVariableExpression(var: !28, expr: !DIExpression())
450!28 = distinct !DIGlobalVariable(name: "globalTLS", linkageName: "?globalTLS@foo@@3HA", scope: !7, file: !3, line: 8, type: !10, isLocal: false, isDefinition: true)
451!29 = !DIGlobalVariableExpression(var: !30, expr: !DIExpression())
452!30 = distinct !DIGlobalVariable(name: "justGlobal", linkageName: "?justGlobal@foo@@3HA", scope: !7, file: !3, line: 10, type: !10, isLocal: false, isDefinition: true)
453!31 = !DIGlobalVariableExpression(var: !32, expr: !DIExpression())
454!32 = distinct !DIGlobalVariable(name: "last", linkageName: "?last@@3HA", scope: !2, file: !3, line: 24, type: !10, isLocal: false, isDefinition: true)
455!33 = !DIGlobalVariableExpression(var: !34, expr: !DIExpression(DW_OP_constu, 8, DW_OP_stack_value))
456!34 = distinct !DIGlobalVariable(name: "constExpr", scope: !7, file: !3, line: 12, type: !14, isLocal: true, isDefinition: true)
457!35 = !DIGlobalVariableExpression(var: !36, expr: !DIExpression(DW_OP_constu, 9, DW_OP_stack_value))
458!36 = distinct !DIGlobalVariable(name: "constVal", scope: !7, file: !3, line: 13, type: !14, isLocal: true, isDefinition: true)
459!37 = !DIGlobalVariableExpression(var: !38, expr: !DIExpression())
460!38 = distinct !DIGlobalVariable(name: "DataStaticTLS", linkageName: "?DataStaticTLS@Data@foo@@2HA", scope: !2, file: !3, line: 16, type: !10, isLocal: false, isDefinition: true, declaration: !9)
461!39 = !DIGlobalVariableExpression(var: !40, expr: !DIExpression())
462!40 = distinct !DIGlobalVariable(name: "DataStatic", linkageName: "?DataStatic@Data@foo@@2HA", scope: !2, file: !3, line: 18, type: !10, isLocal: false, isDefinition: true, declaration: !12)
463!41 = !DIGlobalVariableExpression(var: !42, expr: !DIExpression(DW_OP_constu, 14, DW_OP_stack_value))
464!42 = distinct !DIGlobalVariable(name: "DataConstExpr", scope: !2, file: !3, line: 19, type: !14, isLocal: true, isDefinition: true, declaration: !13)
465!43 = !DIGlobalVariableExpression(var: !44, expr: !DIExpression())
466!44 = distinct !DIGlobalVariable(name: "globalStatic", linkageName: "?globalStatic@foo@@3HA", scope: !7, file: !3, line: 11, type: !10, isLocal: true, isDefinition: true)
467!45 = !DIGlobalVariableExpression(var: !46, expr: !DIExpression())
468!46 = distinct !DIGlobalVariable(name: "staticTLS", linkageName: "?staticTLS@foo@@3HA", scope: !7, file: !3, line: 9, type: !10, isLocal: true, isDefinition: true)
469!47 = !{!"/DEFAULTLIB:libcmt.lib"}
470!48 = !{!"/DEFAULTLIB:oldnames.lib"}
471!49 = !{i32 2, !"CodeView", i32 1}
472!50 = !{i32 2, !"Debug Info Version", i32 3}
473!51 = !{i32 1, !"wchar_size", i32 2}
474!52 = !{i32 7, !"PIC Level", i32 2}
475!53 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git 202f144bffd0be254a829924195e1b8ebabcbb79)"}
476!54 = distinct !DISubprogram(name: "bar", linkageName: "?bar@@YAHXZ", scope: !3, file: !3, line: 26, type: !55, scopeLine: 26, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
477!55 = !DISubroutineType(types: !56)
478!56 = !{!10}
479!57 = !DILocalVariable(name: "D", scope: !54, file: !3, line: 31, type: !6)
480!58 = !DILocation(line: 31, scope: !54)
481!59 = !DILocalVariable(name: "L", scope: !54, file: !3, line: 32, type: !60)
482!60 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "Local", scope: !54, file: !3, line: 27, size: 64, flags: DIFlagTypePassByValue | DIFlagNonTrivial, elements: !61, identifier: ".?AULocal@?1??bar@@YAHXZ@")
483!61 = !{!62, !63}
484!62 = !DIDerivedType(tag: DW_TAG_member, name: "LocalGlobal", scope: !60, file: !3, line: 28, baseType: !10, size: 32)
485!63 = !DIDerivedType(tag: DW_TAG_member, name: "LocalConstVal", scope: !60, file: !3, line: 29, baseType: !14, size: 32, offset: 32)
486!64 = !DILocation(line: 32, scope: !54)
487!65 = !DILocation(line: 33, scope: !54)
488!66 = distinct !DISubprogram(name: "Data", linkageName: "??0Data@foo@@QEAA@XZ", scope: !6, file: !3, line: 15, type: !67, scopeLine: 15, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, declaration: !70, retainedNodes: !4)
489!67 = !DISubroutineType(types: !68)
490!68 = !{null, !69}
491!69 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
492!70 = !DISubprogram(name: "Data", scope: !6, type: !67, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0)
493!71 = !DILocalVariable(name: "this", arg: 1, scope: !66, type: !72, flags: DIFlagArtificial | DIFlagObjectPointer)
494!72 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !6, size: 64)
495!73 = !DILocation(line: 0, scope: !66)
496!74 = !DILocation(line: 15, scope: !66)
497!75 = distinct !DISubprogram(name: "Local", linkageName: "??0Local@?1??bar@@YAHXZ@QEAA@XZ", scope: !60, file: !3, line: 27, type: !76, scopeLine: 27, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, declaration: !79, retainedNodes: !4)
498!76 = !DISubroutineType(types: !77)
499!77 = !{null, !78}
500!78 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !60, size: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
501!79 = !DISubprogram(name: "Local", scope: !60, type: !76, flags: DIFlagArtificial | DIFlagPrototyped, spFlags: 0)
502!80 = !DILocalVariable(name: "this", arg: 1, scope: !75, type: !81, flags: DIFlagArtificial | DIFlagObjectPointer)
503!81 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !60, size: 64)
504!82 = !DILocation(line: 0, scope: !75)
505!83 = !DILocation(line: 27, scope: !75)
506