Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / auto-var-init.cpp
blob6cb18528ebadcdfac03538cf8e2fd9c3eb98af15
1 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK,CHECK-O0
2 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,PATTERN,PATTERN-O0
3 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O1,PATTERN,PATTERN-O1
4 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,ZERO,ZERO-O0
5 // RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown -fblocks -ftrivial-auto-var-init=zero %s -O1 -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O1,ZERO,ZERO-O1
6 // RUN: %clang_cc1 -std=c++14 -triple i386-unknown-unknown -fblocks -ftrivial-auto-var-init=pattern %s -emit-llvm -o - | FileCheck %s -check-prefixes=CHECK-O0,PATTERN,PATTERN-O0
8 #pragma clang diagnostic ignored "-Winaccessible-base"
10 #ifdef __x86_64__
11 char inits[] = {"-86/-21846/-1431655766/i64/-6148914691236517206/-6148914691236517206/i128/-113427455640312821154458202477256070486/i64/-6148914691236517206/AA/"};
12 #else
13 char inits[] = {"-1/-1/-1/i32/-1/-1/i32/-1/i32/-1/FF/"};
14 #define __int128 int;
15 #endif
16 // PATTERN: @inits = {{.*}} c"[[I8:[^/]+]]/[[I16:[^/]+]]/[[I32:[^/]+]]/[[ILONGT:[^/]+]]/[[ILONG:[^/]+]]/[[I64:[^/]+]]/[[I128T:[^/]+]]/[[I128:[^/]+]]/[[IPTRT:[^/]+]]/[[IPTR:[^/]+]]/[[IC:[^/]+]]/\00", align 1
18 template<typename T> void used(T &) noexcept;
20 #define TEST_UNINIT(NAME, TYPE) \
21 using type_##NAME = TYPE; \
22 void test_##NAME##_uninit() { \
23 type_##NAME uninit; \
24 used(uninit); \
27 // Value initialization on scalars, aggregate initialization on aggregates.
28 #define TEST_BRACES(NAME, TYPE) \
29 using type_##NAME = TYPE; \
30 void test_##NAME##_braces() { \
31 type_##NAME braces = {}; \
32 used(braces); \
35 #define TEST_CUSTOM(NAME, TYPE, ...) \
36 using type_##NAME = TYPE; \
37 void test_##NAME##_custom() { \
38 type_##NAME custom __VA_ARGS__; \
39 used(custom); \
42 // None of the synthesized globals should contain `undef`.
43 // PATTERN-NOT: undef
44 // ZERO-NOT: undef
46 // PATTERN-O0: @__const.test_empty_uninit.uninit = private unnamed_addr constant %struct.empty { i8 [[I8]] }, align 1
47 // PATTERN-O1-NOT: @__const.test_empty_uninit.uninit
48 struct empty {};
49 // PATTERN-O0: @__const.test_small_uninit.uninit = private unnamed_addr constant %struct.small { i8 [[I8]] }, align 1
50 // PATTERN-O0: @__const.test_small_custom.custom = private unnamed_addr constant %struct.small { i8 42 }, align 1
51 // ZERO-O0: @__const.test_small_custom.custom = private unnamed_addr constant %struct.small { i8 42 }, align 1
52 // PATTERN-O1-NOT: @__const.test_small_uninit.uninit
53 // PATTERN-O1-NOT: @__const.test_small_custom.custom
54 // ZERO-O1-NOT: @__const.test_small_custom.custom
55 struct small { char c; };
56 // PATTERN-O0: @__const.test_smallinit_uninit.uninit = private unnamed_addr constant %struct.smallinit { i8 [[I8]] }, align 1
57 // PATTERN-O0: @__const.test_smallinit_braces.braces = private unnamed_addr constant %struct.smallinit { i8 [[I8]] }, align 1
58 // PATTERN-O0: @__const.test_smallinit_custom.custom = private unnamed_addr constant %struct.smallinit { i8 [[I8]] }, align 1
59 // PATTERN-O1-NOT: @__const.test_smallinit_uninit.uninit
60 // PATTERN-O1-NOT: @__const.test_smallinit_braces.braces
61 // PATTERN-O1-NOT: @__const.test_smallinit_custom.custom
62 struct smallinit { char c = 42; };
63 // PATTERN-O0: @__const.test_smallpartinit_uninit.uninit = private unnamed_addr constant %struct.smallpartinit { i8 [[I8]], i8 [[I8]] }, align 1
64 // PATTERN-O0: @__const.test_smallpartinit_braces.braces = private unnamed_addr constant %struct.smallpartinit { i8 [[I8]], i8 [[I8]] }, align 1
65 // PATTERN-O0: @__const.test_smallpartinit_custom.custom = private unnamed_addr constant %struct.smallpartinit { i8 [[I8]], i8 [[I8]] }, align 1
66 // PATTERN-O1-NOT: @__const.test_smallpartinit_uninit.uninit
67 // PATTERN-O1-NOT: @__const.test_smallpartinit_braces.braces
68 // PATTERN-O1-NOT: @__const.test_smallpartinit_custom.custom
69 struct smallpartinit { char c = 42, d; };
70 // PATTERN-O0: @__const.test_nullinit_uninit.uninit = private unnamed_addr constant %struct.nullinit { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
71 // PATTERN-O0: @__const.test_nullinit_braces.braces = private unnamed_addr constant %struct.nullinit { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
72 // PATTERN-O0: @__const.test_nullinit_custom.custom = private unnamed_addr constant %struct.nullinit { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
73 // PATTERN-O1-NOT: @__const.test_nullinit_uninit.uninit
74 // PATTERN-O1-NOT: @__const.test_nullinit_braces.braces
75 // PATTERN-O1-NOT: @__const.test_nullinit_custom.custom
76 struct nullinit { char* null = nullptr; };
77 // PATTERN-O0: @__const.test_padded_uninit.uninit = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, align 4
78 // PATTERN-O0: @__const.test_padded_custom.custom = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 42, [3 x i8] zeroinitializer, i32 13371337 }, align 4
79 // ZERO-O0: @__const.test_padded_custom.custom = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 42, [3 x i8] zeroinitializer, i32 13371337 }, align 4
80 // PATTERN-O1-NOT: @__const.test_padded_uninit.uninit
81 // PATTERN-O1-NOT: @__const.test_padded_custom.custom
82 // ZERO-O1-NOT: @__const.test_padded_custom.custom
83 struct padded { char c; int i; };
84 // PATTERN-O0: @__const.test_paddednullinit_uninit.uninit = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, align 4
85 // PATTERN-O0: @__const.test_paddednullinit_braces.braces = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, align 4
86 // PATTERN-O0: @__const.test_paddednullinit_custom.custom = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, align 4
87 // PATTERN-O1-NOT: @__const.test_paddednullinit_uninit.uninit
88 // PATTERN-O1-NOT: @__const.test_paddednullinit_braces.braces
89 // PATTERN-O1-NOT: @__const.test_paddednullinit_custom.custom
90 struct paddednullinit { char c = 0; int i = 0; };
91 // PATTERN-O0: @__const.test_paddedpacked_uninit.uninit = private unnamed_addr constant %struct.paddedpacked <{ i8 [[I8]], i32 [[I32]] }>, align 1
92 // PATTERN: @__const.test_paddedpacked_custom.custom = private unnamed_addr constant %struct.paddedpacked <{ i8 42, i32 13371337 }>, align 1
93 // ZERO: @__const.test_paddedpacked_custom.custom = private unnamed_addr constant %struct.paddedpacked <{ i8 42, i32 13371337 }>, align 1
94 struct paddedpacked { char c; int i; } __attribute__((packed));
95 // PATTERN-O0: @__const.test_paddedpackedarray_uninit.uninit = private unnamed_addr constant %struct.paddedpackedarray { [2 x %struct.paddedpacked] [%struct.paddedpacked <{ i8 [[I8]], i32 [[I32]] }>, %struct.paddedpacked <{ i8 [[I8]], i32 [[I32]] }>] }, align 1
96 // PATTERN: @__const.test_paddedpackedarray_custom.custom = private unnamed_addr constant %struct.paddedpackedarray { [2 x %struct.paddedpacked] [%struct.paddedpacked <{ i8 42, i32 13371337 }>, %struct.paddedpacked <{ i8 43, i32 13371338 }>] }, align 1
97 // ZERO: @__const.test_paddedpackedarray_custom.custom = private unnamed_addr constant %struct.paddedpackedarray { [2 x %struct.paddedpacked] [%struct.paddedpacked <{ i8 42, i32 13371337 }>, %struct.paddedpacked <{ i8 43, i32 13371338 }>] }, align 1
98 struct paddedpackedarray { struct paddedpacked p[2]; };
99 // PATTERN-O0: @__const.test_unpackedinpacked_uninit.uninit = private unnamed_addr constant <{ { i8, [3 x i8], i32 }, i8 }> <{ { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, i8 [[I8]] }>, align 1
100 struct unpackedinpacked { padded a; char b; } __attribute__((packed));
101 // PATTERN-O0: @__const.test_paddednested_uninit.uninit = private unnamed_addr constant { { i8, [3 x i8], i32 }, { i8, [3 x i8], i32 } } { { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] } }, align 4
102 // PATTERN: @__const.test_paddednested_custom.custom = private unnamed_addr constant { { i8, [3 x i8], i32 }, { i8, [3 x i8], i32 } } { { i8, [3 x i8], i32 } { i8 42, [3 x i8] zeroinitializer, i32 13371337 }, { i8, [3 x i8], i32 } { i8 43, [3 x i8] zeroinitializer, i32 13371338 } }, align 4
103 // ZERO: @__const.test_paddednested_custom.custom = private unnamed_addr constant { { i8, [3 x i8], i32 }, { i8, [3 x i8], i32 } } { { i8, [3 x i8], i32 } { i8 42, [3 x i8] zeroinitializer, i32 13371337 }, { i8, [3 x i8], i32 } { i8 43, [3 x i8] zeroinitializer, i32 13371338 } }, align 4
104 struct paddednested { struct padded p1, p2; };
105 // PATTERN-O0: @__const.test_paddedpackednested_uninit.uninit = private unnamed_addr constant %struct.paddedpackednested { %struct.paddedpacked <{ i8 [[I8]], i32 [[I32]] }>, %struct.paddedpacked <{ i8 [[I8]], i32 [[I32]] }> }, align 1
106 // PATTERN: @__const.test_paddedpackednested_custom.custom = private unnamed_addr constant %struct.paddedpackednested { %struct.paddedpacked <{ i8 42, i32 13371337 }>, %struct.paddedpacked <{ i8 43, i32 13371338 }> }, align 1
107 // ZERO: @__const.test_paddedpackednested_custom.custom = private unnamed_addr constant %struct.paddedpackednested { %struct.paddedpacked <{ i8 42, i32 13371337 }>, %struct.paddedpacked <{ i8 43, i32 13371338 }> }, align 1
108 struct paddedpackednested { struct paddedpacked p1, p2; };
109 // PATTERN-O0: @__const.test_bitfield_uninit.uninit = private unnamed_addr constant %struct.bitfield { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
110 // PATTERN-O0: @__const.test_bitfield_custom.custom = private unnamed_addr constant %struct.bitfield { i8 20, [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
111 // ZERO-O0: @__const.test_bitfield_custom.custom = private unnamed_addr constant %struct.bitfield { i8 20, [3 x i8] zeroinitializer }, align 4
112 // PATTERN-O1-NOT: @__const.test_bitfield_uninit.uninit
113 // PATTERN-O1-NOT: @__const.test_bitfield_custom.custom
114 // ZERO-O1-NOT: @__const.test_bitfield_custom.custom
115 struct bitfield { int i : 4; int j : 2; };
116 // PATTERN-O0: @__const.test_bitfieldaligned_uninit.uninit = private unnamed_addr constant %struct.bitfieldaligned { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
117 // PATTERN-O0: @__const.test_bitfieldaligned_custom.custom = private unnamed_addr constant %struct.bitfieldaligned { i8 4, [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i8 1, [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
118 // ZERO-O0: @__const.test_bitfieldaligned_custom.custom = private unnamed_addr constant %struct.bitfieldaligned { i8 4, [3 x i8] zeroinitializer, i8 1, [3 x i8] zeroinitializer }, align 4
119 // PATTERN-O1-NOT: @__const.test_bitfieldaligned_uninit.uninit
120 // PATTERN-O1-NOT: @__const.test_bitfieldaligned_custom.custom
121 // ZERO-O1-NOT: @__const.test_bitfieldaligned_custom.custom
122 struct bitfieldaligned { int i : 4; int : 0; int j : 2; };
123 struct big { unsigned a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z; };
124 // PATTERN-O0: @__const.test_arraytail_uninit.uninit = private unnamed_addr constant %struct.arraytail { i32 [[I32]], [0 x i32] zeroinitializer }, align 4
125 // PATTERN-O0: @__const.test_arraytail_custom.custom = private unnamed_addr constant %struct.arraytail { i32 57005, [0 x i32] zeroinitializer }, align 4
126 // ZERO-O0: @__const.test_arraytail_custom.custom = private unnamed_addr constant %struct.arraytail { i32 57005, [0 x i32] zeroinitializer }, align 4
127 // PATTERN-O1-NOT: @__const.test_arraytail_uninit.uninit
128 // PATTERN-O1-NOT: @__const.test_arraytail_custom.custom
129 // ZERO-O1-NOT: @__const.test_arraytail_custom.custom
130 struct arraytail { int i; int arr[]; };
131 // PATTERN-O0: @__const.test_int1_uninit.uninit = private unnamed_addr constant [1 x i32] {{\[}}i32 [[I32]]], align 4
132 // PATTERN-O0: @__const.test_int1_custom.custom = private unnamed_addr constant [1 x i32] [i32 858993459], align 4
133 // ZERO-O0: @__const.test_int1_custom.custom = private unnamed_addr constant [1 x i32] [i32 858993459], align 4
134 // PATTERN-O1-NOT: @__const.test_int1_uninit.uninit
135 // PATTERN-O1-NOT: @__const.test_int1_custom.custom
136 // ZERO-O1-NOT: @__const.test_int1_custom.custom
138 // PATTERN-O0: @__const.test_bool4_uninit.uninit = private unnamed_addr constant [4 x i8] c"\[[IC]]\[[IC]]\[[IC]]\[[IC]]", align 1
139 // PATTERN-O0: @__const.test_bool4_custom.custom = private unnamed_addr constant [4 x i8] c"\01\01\01\01", align 1
140 // ZERO-O0: @__const.test_bool4_custom.custom = private unnamed_addr constant [4 x i8] c"\01\01\01\01", align 1
141 // PATTERN-O1-NOT: @__const.test_bool4_uninit.uninit
142 // PATTERN-O1-NOT: @__const.test_bool4_custom.custom
143 // ZERO-O1-NOT: @__const.test_bool4_custom.custom
145 // PATTERN: @__const.test_intptr4_custom.custom = private unnamed_addr constant [4 x ptr] [ptr inttoptr ([[IPTRT]] 572662306 to ptr), ptr inttoptr ([[IPTRT]] 572662306 to ptr), ptr inttoptr ([[IPTRT]] 572662306 to ptr), ptr inttoptr ([[IPTRT]] 572662306 to ptr)], align
146 // ZERO: @__const.test_intptr4_custom.custom = private unnamed_addr constant [4 x ptr] [ptr inttoptr (i64 572662306 to ptr), ptr inttoptr (i64 572662306 to ptr), ptr inttoptr (i64 572662306 to ptr), ptr inttoptr (i64 572662306 to ptr)], align 16
147 // PATTERN-O0: @__const.test_tailpad4_uninit.uninit = private unnamed_addr constant [4 x { i16, i8, [1 x i8] }] [{ i16, i8, [1 x i8] } { i16 [[I16]], i8 [[I8]], [1 x i8] c"\[[IC]]" }, { i16, i8, [1 x i8] } { i16 [[I16]], i8 [[I8]], [1 x i8] c"\[[IC]]" }, { i16, i8, [1 x i8] } { i16 [[I16]], i8 [[I8]], [1 x i8] c"\[[IC]]" }, { i16, i8, [1 x i8] } { i16 [[I16]], i8 [[I8]], [1 x i8] c"\[[IC]]" }], align
148 // PATTERN-O1-NOT: @__const.test_tailpad4_uninit.uninit
149 // PATTERN: @__const.test_tailpad4_custom.custom = private unnamed_addr constant [4 x { i16, i8, [1 x i8] }] [{ i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }], align
150 // ZERO: @__const.test_tailpad4_custom.custom = private unnamed_addr constant [4 x { i16, i8, [1 x i8] }] [{ i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }, { i16, i8, [1 x i8] } { i16 257, i8 1, [1 x i8] zeroinitializer }], align 16
151 struct tailpad { short s; char c; };
152 // PATTERN-O0: @__const.test_atomicnotlockfree_uninit.uninit = private unnamed_addr constant %struct.notlockfree { [4 x i64] {{\[}}i64 [[I64]], i64 [[I64]], i64 [[I64]], i64 [[I64]]] }, align
153 // PATTERN-O1-NOT: @__const.test_atomicnotlockfree_uninit.uninit
154 struct notlockfree { long long a[4]; };
155 // PATTERN-O0: @__const.test_atomicpadded_uninit.uninit = private unnamed_addr constant { i8, [3 x i8], i32 } { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]", i32 [[I32]] }, align 8
156 // PATTERN-O1-NOT: @__const.test_atomicpadded_uninit.uninit
157 // PATTERN-O0: @__const.test_atomictailpad_uninit.uninit = private unnamed_addr constant { i16, i8, [1 x i8] } { i16 [[I16]], i8 [[I8]], [1 x i8] c"\[[IC]]" }, align 4
158 // PATTERN-O1-NOT: @__const.test_atomictailpad_uninit.uninit
159 // PATTERN-O0: @__const.test_complexfloat_uninit.uninit = private unnamed_addr constant { float, float } { float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000 }, align 4
160 // PATTERN-O1-NOT: @__const.test_complexfloat_uninit.uninit
161 // PATTERN-O0: @__const.test_complexfloat_braces.braces = private unnamed_addr constant { float, float } { float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000 }, align 4
162 // PATTERN-O1-NOT: @__const.test_complexfloat_braces.braces
163 // PATTERN-O0: @__const.test_complexfloat_custom.custom = private unnamed_addr constant { float, float } { float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000 }, align 4
164 // PATTERN-O1-NOT: @__const.test_complexfloat_custom.custom
165 // PATTERN-O0: @__const.test_complexdouble_uninit.uninit = private unnamed_addr constant { double, double } { double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF }, align 8
166 // PATTERN-O1-NOT: @__const.test_complexdouble_uninit.uninit
167 // PATTERN-O0: @__const.test_complexdouble_braces.braces = private unnamed_addr constant { double, double } { double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF }, align 8
168 // PATTERN-O1-NOT: @__const.test_complexdouble_braces.braces
169 // PATTERN-O0: @__const.test_complexdouble_custom.custom = private unnamed_addr constant { double, double } { double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF }, align 8
170 // PATTERN-O1-NOT: @__const.test_complexdouble_custom.custom
171 // PATTERN-O0: @__const.test_semivolatile_uninit.uninit = private unnamed_addr constant %struct.semivolatile { i32 [[I32]], i32 [[I32]] }, align 4
172 // PATTERN-O0: @__const.test_semivolatile_custom.custom = private unnamed_addr constant %struct.semivolatile { i32 1145324612, i32 1145324612 }, align 4
173 // PATTERN-O1-NOT: @__const.test_semivolatile_custom.custom
174 struct semivolatile { int i; volatile int vi; };
175 // PATTERN-O0: @__const.test_semivolatileinit_uninit.uninit = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
176 // PATTERN-O1-NOT: @__const.test_semivolatileinit_uninit.uninit
177 // PATTERN-O0: @__const.test_semivolatileinit_braces.braces = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
178 // PATTERN-O1-NOT: @__const.test_semivolatileinit_braces.braces
179 // PATTERN-O0: @__const.test_semivolatileinit_custom.custom = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
180 // PATTERN-O1-NOT: @__const.test_semivolatileinit_custom.custom = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
181 // ZERO-O0: @__const.test_semivolatile_custom.custom = private unnamed_addr constant %struct.semivolatile { i32 1145324612, i32 1145324612 }, align 4
182 // ZERO-O1-NOT: @__const.test_semivolatile_custom.custom
183 struct semivolatileinit { int i = 0x11111111; volatile int vi = 0x11111111; };
184 // PATTERN-O0: @__const.test_base_uninit.uninit = private unnamed_addr constant %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
185 // PATTERN-O1-NOT: @__const.test_base_uninit.uninit
186 // PATTERN-O0: @__const.test_base_braces.braces = private unnamed_addr constant %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
187 // PATTERN-O1-NOT: @__const.test_base_braces.braces
188 struct base { virtual ~base(); };
189 // PATTERN-O0: @__const.test_derived_uninit.uninit = private unnamed_addr constant %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } }, align
190 // PATTERN-O1-NOT: @__const.test_derived_uninit.uninit
191 // PATTERN-O0: @__const.test_derived_braces.braces = private unnamed_addr constant %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } }, align
192 // PATTERN-O1-NOT: @__const.test_derived_braces.braces
193 struct derived : public base {};
194 // PATTERN-O0: @__const.test_virtualderived_uninit.uninit = private unnamed_addr constant %struct.virtualderived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } } }, align
195 // PATTERN-O1-NOT: @__const.test_virtualderived_uninit.uninit
196 // PATTERN-O0: @__const.test_virtualderived_braces.braces = private unnamed_addr constant %struct.virtualderived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } } }, align
197 // PATTERN-O1-NOT: @__const.test_virtualderived_braces.braces
198 struct virtualderived : public virtual base, public virtual derived {};
199 // PATTERN-O0: @__const.test_matching_uninit.uninit = private unnamed_addr constant %union.matching { i32 [[I32]] }, align 4
200 // PATTERN-O1-NOT: @__const.test_matching_uninit.uninit
201 // PATTERN-O0: @__const.test_matching_custom.custom = private unnamed_addr constant { float } { float 6.145500e+04 }, align 4
202 // PATTERN-O1-NOT: @__const.test_matching_custom.custom
203 // ZERO-O0: @__const.test_matching_custom.custom = private unnamed_addr constant { float } { float 6.145500e+04 }, align 4
204 // ZERO-O1-NOT: @__const.test_matching_custom.custom
205 union matching { int i; float f; };
206 // PATTERN-O0: @__const.test_matchingreverse_uninit.uninit = private unnamed_addr constant %union.matchingreverse { float 0xFFFFFFFFE0000000 }, align 4
207 // PATTERN-O1-NOT: @__const.test_matchingreverse_uninit.uninit
208 // PATTERN-O0: @__const.test_matchingreverse_custom.custom = private unnamed_addr constant { i32 } { i32 61455 }, align 4
209 // PATTERN-O1-NOT: @__const.test_matchingreverse_custom.custom
210 // ZERO-O0: @__const.test_matchingreverse_custom.custom = private unnamed_addr constant { i32 } { i32 61455 }, align 4
211 // ZERO-O1-NOT: @__const.test_matchingreverse_custom.custom
212 union matchingreverse { float f; int i; };
213 // PATTERN-O0: @__const.test_unmatched_uninit.uninit = private unnamed_addr constant %union.unmatched { i32 [[I32]] }, align 4
214 // PATTERN-O1-NOT: @__const.test_unmatched_uninit.uninit
215 // PATTERN-O0: @__const.test_unmatched_custom.custom = private unnamed_addr constant %union.unmatched { i32 1001242351 }, align 4
216 // PATTERN-O1-NOT: @__const.test_unmatched_custom.custom
217 // ZERO-O0: @__const.test_unmatched_custom.custom = private unnamed_addr constant %union.unmatched { i32 1001242351 }, align 4
218 // ZERO-O1-NOT: @__const.test_unmatched_custom.custom
219 union unmatched { char c; int i; };
220 // PATTERN-O0: @__const.test_unmatchedreverse_uninit.uninit = private unnamed_addr constant %union.unmatchedreverse { i32 [[I32]] }, align 4
221 // PATTERN-O1-NOT: @__const.test_unmatchedreverse_uninit.uninit
222 // PATTERN-O0: @__const.test_unmatchedreverse_custom.custom = private unnamed_addr constant { i8, [3 x i8] } { i8 42, [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
223 // PATTERN-O1-NOT: @__const.test_unmatchedreverse_custom.custom
224 // ZERO-O0: @__const.test_unmatchedreverse_custom.custom = private unnamed_addr constant { i8, [3 x i8] } { i8 42, [3 x i8] zeroinitializer }, align 4
225 // ZERO-O1-NOT: @__const.test_unmatchedreverse_custom.custom
226 union unmatchedreverse { int i; char c; };
227 // PATTERN-O0: @__const.test_unmatchedfp_uninit.uninit = private unnamed_addr constant %union.unmatchedfp { double 0xFFFFFFFFFFFFFFFF }, align
228 // PATTERN-O1-NOT: @__const.test_unmatchedfp_uninit.uninit
229 // PATTERN-O0: @__const.test_unmatchedfp_custom.custom = private unnamed_addr constant %union.unmatchedfp { double 0x400921FB54442D18 }, align
230 // PATTERN-O1-NOT: @__const.test_unmatchedfp_custom.custom
231 // ZERO-O0: @__const.test_unmatchedfp_custom.custom = private unnamed_addr constant %union.unmatchedfp { double 0x400921FB54442D18 }, align 8
232 // ZERO-O1-NOT: @__const.test_unmatchedfp_custom.custom
233 union unmatchedfp { float f; double d; };
234 enum emptyenum {};
235 enum smallenum { VALUE };
237 extern "C" {
239 TEST_UNINIT(char, char);
240 // CHECK-LABEL: @test_char_uninit()
241 // CHECK: %uninit = alloca i8, align
242 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
243 // PATTERN-LABEL: @test_char_uninit()
244 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
245 // ZERO-LABEL: @test_char_uninit()
246 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
248 TEST_BRACES(char, char);
249 // CHECK-LABEL: @test_char_braces()
250 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
251 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
252 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
254 TEST_UNINIT(uchar, unsigned char);
255 // CHECK-LABEL: @test_uchar_uninit()
256 // CHECK: %uninit = alloca i8, align
257 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
258 // PATTERN-LABEL: @test_uchar_uninit()
259 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
260 // ZERO-LABEL: @test_uchar_uninit()
261 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
263 TEST_BRACES(uchar, unsigned char);
264 // CHECK-LABEL: @test_uchar_braces()
265 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
266 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
267 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
269 TEST_UNINIT(schar, signed char);
270 // CHECK-LABEL: @test_schar_uninit()
271 // CHECK: %uninit = alloca i8, align
272 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
273 // PATTERN-LABEL: @test_schar_uninit()
274 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
275 // ZERO-LABEL: @test_schar_uninit()
276 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
278 TEST_BRACES(schar, signed char);
279 // CHECK-LABEL: @test_schar_braces()
280 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
281 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
282 // CHECK-NOT: !annotation
283 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
285 TEST_UNINIT(wchar_t, wchar_t);
286 // CHECK-LABEL: @test_wchar_t_uninit()
287 // CHECK: %uninit = alloca i32, align
288 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
289 // PATTERN-LABEL: @test_wchar_t_uninit()
290 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
291 // ZERO-LABEL: @test_wchar_t_uninit()
292 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
294 TEST_BRACES(wchar_t, wchar_t);
295 // CHECK-LABEL: @test_wchar_t_braces()
296 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
297 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
298 // CHECK-NOT: !annotation
299 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
301 TEST_UNINIT(short, short);
302 // CHECK-LABEL: @test_short_uninit()
303 // CHECK: %uninit = alloca i16, align
304 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
305 // PATTERN-LABEL: @test_short_uninit()
306 // PATTERN: store i16 [[I16]], ptr %uninit, align 2, !annotation [[AUTO_INIT]]
307 // ZERO-LABEL: @test_short_uninit()
308 // ZERO: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
310 TEST_BRACES(short, short);
311 // CHECK-LABEL: @test_short_braces()
312 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]]
313 // CHECK-NEXT: store i16 0, ptr %braces, align [[ALIGN]]
314 // CHECK-NOT: !annotation
315 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
317 TEST_UNINIT(ushort, unsigned short);
318 // CHECK-LABEL: @test_ushort_uninit()
319 // CHECK: %uninit = alloca i16, align
320 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
321 // PATTERN-LABEL: @test_ushort_uninit()
322 // PATTERN: store i16 [[I16]], ptr %uninit, align 2, !annotation [[AUTO_INIT]]
323 // ZERO-LABEL: @test_ushort_uninit()
324 // ZERO: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
326 TEST_BRACES(ushort, unsigned short);
327 // CHECK-LABEL: @test_ushort_braces()
328 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]]
329 // CHECK-NEXT: store i16 0, ptr %braces, align [[ALIGN]]
330 //CHECK-NOT: !annotation
331 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
333 TEST_UNINIT(int, int);
334 // CHECK-LABEL: @test_int_uninit()
335 // CHECK: %uninit = alloca i32, align
336 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
337 // PATTERN-LABEL: @test_int_uninit()
338 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
339 // ZERO-LABEL: @test_int_uninit()
340 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
342 TEST_BRACES(int, int);
343 // CHECK-LABEL: @test_int_braces()
344 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
345 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
346 // CHECK-NOT: !annotation
347 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
349 TEST_UNINIT(unsigned, unsigned);
350 // CHECK-LABEL: @test_unsigned_uninit()
351 // CHECK: %uninit = alloca i32, align
352 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
353 // PATTERN-LABEL: @test_unsigned_uninit()
354 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
355 // ZERO-LABEL: @test_unsigned_uninit()
356 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
358 TEST_BRACES(unsigned, unsigned);
359 // CHECK-LABEL: @test_unsigned_braces()
360 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
361 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
362 // CHECK-NOT: !annotation
363 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
365 TEST_UNINIT(long, long);
366 // CHECK-LABEL: @test_long_uninit()
367 // CHECK: %uninit = alloca i64, align
368 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
369 // PATTERN-LABEL: @test_long_uninit()
370 // PATTERN: store [[ILONGT]] [[ILONG]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
371 // ZERO-LABEL: @test_long_uninit()
372 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
374 TEST_BRACES(long, long);
375 // CHECK-LABEL: @test_long_braces()
376 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
377 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
378 // CHECK-NOT: !annotation
379 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
381 TEST_UNINIT(ulong, unsigned long);
382 // CHECK-LABEL: @test_ulong_uninit()
383 // CHECK: %uninit = alloca i64, align
384 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
385 // PATTERN-LABEL: @test_ulong_uninit()
386 // PATTERN: store [[ILONGT]] [[ILONG]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
387 // ZERO-LABEL: @test_ulong_uninit()
388 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
390 TEST_BRACES(ulong, unsigned long);
391 // CHECK-LABEL: @test_ulong_braces()
392 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
393 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
394 // CHECK-NOT: !annotation
395 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
397 TEST_UNINIT(longlong, long long);
398 // CHECK-LABEL: @test_longlong_uninit()
399 // CHECK: %uninit = alloca i64, align
400 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
401 // PATTERN-LABEL: @test_longlong_uninit()
402 // PATTERN: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
403 // ZERO-LABEL: @test_longlong_uninit()
404 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
406 TEST_BRACES(longlong, long long);
407 // CHECK-LABEL: @test_longlong_braces()
408 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
409 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
410 // CHECK-NOT: !annotation
411 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
413 TEST_UNINIT(ulonglong, unsigned long long);
414 // CHECK-LABEL: @test_ulonglong_uninit()
415 // CHECK: %uninit = alloca i64, align
416 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
417 // PATTERN-LABEL: @test_ulonglong_uninit()
418 // PATTERN: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
419 // ZERO-LABEL: @test_ulonglong_uninit()
420 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
422 TEST_BRACES(ulonglong, unsigned long long);
423 // CHECK-LABEL: @test_ulonglong_braces()
424 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
425 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
426 // CHECK-NOT: !annotation
427 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
429 TEST_UNINIT(int128, __int128);
430 // CHECK-LABEL: @test_int128_uninit()
431 // CHECK: %uninit = alloca i128, align
432 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
433 // PATTERN-LABEL: @test_int128_uninit()
434 // PATTERN: store [[I128T]] [[I128]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
435 // ZERO-LABEL: @test_int128_uninit()
436 // ZERO: store i128 0, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
438 TEST_BRACES(int128, __int128);
439 // CHECK-LABEL: @test_int128_braces()
440 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]]
441 // CHECK-NEXT: store i128 0, ptr %braces, align [[ALIGN]]
442 // CHECK-NOT: !annotation
443 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
445 TEST_UNINIT(uint128, unsigned __int128);
446 // CHECK-LABEL: @test_uint128_uninit()
447 // CHECK: %uninit = alloca i128, align
448 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
449 // PATTERN-LABEL: @test_uint128_uninit()
450 // PATTERN: store [[I128T]] [[I128]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
451 // ZERO-LABEL: @test_uint128_uninit()
452 // ZERO: store i128 0, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
454 TEST_BRACES(uint128, unsigned __int128);
455 // CHECK-LABEL: @test_uint128_braces()
456 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]]
457 // CHECK-NEXT: store i128 0, ptr %braces, align [[ALIGN]]
458 // CHECK-NOT: !annotation
459 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
461 TEST_UNINIT(fp16, __fp16);
462 // CHECK-LABEL: @test_fp16_uninit()
463 // CHECK: %uninit = alloca half, align
464 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
465 // PATTERN-LABEL: @test_fp16_uninit()
466 // PATTERN: store half 0xHFFFF, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
467 // ZERO-LABEL: @test_fp16_uninit()
468 // ZERO: store half 0xH0000, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
470 TEST_BRACES(fp16, __fp16);
471 // CHECK-LABEL: @test_fp16_braces()
472 // CHECK: %braces = alloca half, align [[ALIGN:[0-9]*]]
473 // CHECK-NEXT: store half 0xH0000, ptr %braces, align [[ALIGN]]
474 // CHECK-NOT: !annotation
475 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
477 TEST_UNINIT(float, float);
478 // CHECK-LABEL: @test_float_uninit()
479 // CHECK: %uninit = alloca float, align
480 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
481 // PATTERN-LABEL: @test_float_uninit()
482 // PATTERN: store float 0xFFFFFFFFE0000000, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
483 // ZERO-LABEL: @test_float_uninit()
484 // ZERO: store float 0.000000e+00, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
486 TEST_BRACES(float, float);
487 // CHECK-LABEL: @test_float_braces()
488 // CHECK: %braces = alloca float, align [[ALIGN:[0-9]*]]
489 // CHECK-NEXT: store float 0.000000e+00, ptr %braces, align [[ALIGN]]
490 // CHECK-NOT: !annotation
491 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
493 TEST_UNINIT(double, double);
494 // CHECK-LABEL: @test_double_uninit()
495 // CHECK: %uninit = alloca double, align
496 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
497 // PATTERN-LABEL: @test_double_uninit()
498 // PATTERN: store double 0xFFFFFFFFFFFFFFFF, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
499 // ZERO-LABEL: @test_double_uninit()
500 // ZERO: store double 0.000000e+00, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
502 TEST_BRACES(double, double);
503 // CHECK-LABEL: @test_double_braces()
504 // CHECK: %braces = alloca double, align [[ALIGN:[0-9]*]]
505 // CHECK-NEXT: store double 0.000000e+00, ptr %braces, align [[ALIGN]]
506 // CHECK-NOT: !annotation
507 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
509 TEST_UNINIT(longdouble, long double);
510 // CHECK-LABEL: @test_longdouble_uninit()
511 // CHECK: %uninit = alloca x86_fp80, align
512 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
513 // PATTERN-LABEL: @test_longdouble_uninit()
514 // PATTERN: store x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
515 // ZERO-LABEL: @test_longdouble_uninit()
516 // ZERO: store x86_fp80 0xK00000000000000000000, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
518 TEST_BRACES(longdouble, long double);
519 // CHECK-LABEL: @test_longdouble_braces()
520 // CHECK: %braces = alloca x86_fp80, align [[ALIGN:[0-9]*]]
521 // CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr %braces, align [[ALIGN]]
522 // CHECK-NOT: !annotation
523 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
525 TEST_UNINIT(intptr, int*);
526 // CHECK-LABEL: @test_intptr_uninit()
527 // CHECK: %uninit = alloca ptr, align
528 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
529 // PATTERN-LABEL: @test_intptr_uninit()
530 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
531 // ZERO-LABEL: @test_intptr_uninit()
532 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
534 TEST_BRACES(intptr, int*);
535 // CHECK-LABEL: @test_intptr_braces()
536 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
537 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
538 // CHECK-NOT: !annotation
539 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
541 TEST_UNINIT(intptrptr, int**);
542 // CHECK-LABEL: @test_intptrptr_uninit()
543 // CHECK: %uninit = alloca ptr, align
544 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
545 // PATTERN-LABEL: @test_intptrptr_uninit()
546 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
547 // ZERO-LABEL: @test_intptrptr_uninit()
548 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
550 TEST_BRACES(intptrptr, int**);
551 // CHECK-LABEL: @test_intptrptr_braces()
552 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
553 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
554 // CHECK-NOT: !annotation
555 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
557 TEST_UNINIT(function, void(*)());
558 // CHECK-LABEL: @test_function_uninit()
559 // CHECK: %uninit = alloca ptr, align
560 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
561 // PATTERN-LABEL: @test_function_uninit()
562 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
563 // ZERO-LABEL: @test_function_uninit()
564 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
566 TEST_BRACES(function, void(*)());
567 // CHECK-LABEL: @test_function_braces()
568 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
569 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
570 // CHECK-NOT: !annotation
571 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
573 TEST_UNINIT(bool, bool);
574 // CHECK-LABEL: @test_bool_uninit()
575 // CHECK: %uninit = alloca i8, align
576 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
577 // PATTERN-LABEL: @test_bool_uninit()
578 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
579 // ZERO-LABEL: @test_bool_uninit()
580 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
582 TEST_BRACES(bool, bool);
583 // CHECK-LABEL: @test_bool_braces()
584 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
585 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
586 // CHECK-NOT: !annotation
587 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
589 TEST_UNINIT(empty, empty);
590 // CHECK-LABEL: @test_empty_uninit()
591 // CHECK: %uninit = alloca %struct.empty, align
592 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
593 // PATTERN-LABEL: @test_empty_uninit()
594 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_empty_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
595 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
596 // ZERO-LABEL: @test_empty_uninit()
597 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
598 // ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
600 TEST_BRACES(empty, empty);
601 // CHECK-LABEL: @test_empty_braces()
602 // CHECK: %braces = alloca %struct.empty, align
603 // CHECK-NEXT: call void @llvm.memcpy
604 // CHECK-NOT: !annotation
605 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
607 TEST_UNINIT(small, small);
608 // CHECK-LABEL: @test_small_uninit()
609 // CHECK: %uninit = alloca %struct.small, align
610 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
611 // PATTERN-LABEL: @test_small_uninit()
612 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_small_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
613 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
614 // ZERO-LABEL: @test_small_uninit()
615 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
616 // ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
618 TEST_BRACES(small, small);
619 // CHECK-LABEL: @test_small_braces()
620 // CHECK: %braces = alloca %struct.small, align [[ALIGN:[0-9]*]]
621 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 1, i1 false)
622 // CHECK-NOT: !annotation
623 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
625 TEST_CUSTOM(small, small, { 42 });
626 // CHECK-LABEL: @test_small_custom()
627 // CHECK: %custom = alloca %struct.small, align
628 // CHECK-NEXT: call void @llvm.memcpy
629 // CHECK-NOT: !annotation
630 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
632 TEST_UNINIT(smallinit, smallinit);
633 // CHECK-LABEL: @test_smallinit_uninit()
634 // CHECK: %uninit = alloca %struct.smallinit, align
635 // CHECK-NEXT: call void @{{.*}}smallinit{{.*}}%uninit)
636 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
638 TEST_BRACES(smallinit, smallinit);
639 // CHECK-LABEL: @test_smallinit_braces()
640 // CHECK: %braces = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
641 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, ptr %braces, i32 0, i32 0
642 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
643 // CHECK-NOT: !annotation
644 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
646 TEST_CUSTOM(smallinit, smallinit, { 100 });
647 // CHECK-LABEL: @test_smallinit_custom()
648 // CHECK: %custom = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
649 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, ptr %custom, i32 0, i32 0
650 // CHECK-NEXT: store i8 100, ptr %[[C]], align [[ALIGN]]
651 // CHECK-NOT: !annotation
652 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
654 TEST_UNINIT(smallpartinit, smallpartinit);
655 // CHECK-LABEL: @test_smallpartinit_uninit()
656 // CHECK: %uninit = alloca %struct.smallpartinit, align
657 // CHECK-NEXT: call void @{{.*}}smallpartinit{{.*}}%uninit)
658 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
659 // PATTERN-LABEL: @test_smallpartinit_uninit()
660 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_smallpartinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
661 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
662 // PATTERN-O1: store i8 42, {{.*}} align 1
663 // ZERO-LABEL: @test_smallpartinit_uninit()
664 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
665 // ZERO-O1: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
667 TEST_BRACES(smallpartinit, smallpartinit);
668 // CHECK-LABEL: @test_smallpartinit_braces()
669 // CHECK: %braces = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
670 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, ptr %braces, i32 0, i32 0
671 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
672 // CHECK-NOT: !annotation
673 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, ptr %braces, i32 0, i32 1
674 // CHECK-NEXT: store i8 0, ptr %[[D]], align [[ALIGN]]
675 // CHECK-NOT: !annotation
676 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
678 TEST_CUSTOM(smallpartinit, smallpartinit, { 100, 42 });
679 // CHECK-LABEL: @test_smallpartinit_custom()
680 // CHECK: %custom = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
681 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, ptr %custom, i32 0, i32 0
682 // CHECK-NEXT: store i8 100, ptr %[[C]], align [[ALIGN]]
683 // CHECK-NOT: !annotation
684 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, ptr %custom, i32 0, i32 1
685 // CHECK-NEXT: store i8 42, ptr %[[D]], align [[ALIGN]]
686 // CHECK-NOT: !annotation
687 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
689 TEST_UNINIT(nullinit, nullinit);
690 // CHECK-LABEL: @test_nullinit_uninit()
691 // CHECK: %uninit = alloca %struct.nullinit, align
692 // CHECK-NEXT: call void @{{.*}}nullinit{{.*}}%uninit)
693 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
695 TEST_BRACES(nullinit, nullinit);
696 // CHECK-LABEL: @test_nullinit_braces()
697 // CHECK: %braces = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
698 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, ptr %braces, i32 0, i32 0
699 // CHECK-NEXT: store ptr null, ptr %[[N]], align [[ALIGN]]
700 // CHECK-NOT: !annotation
701 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
703 TEST_CUSTOM(nullinit, nullinit, { (char*)"derp" });
704 // CHECK-LABEL: @test_nullinit_custom()
705 // CHECK: %custom = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
706 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, ptr %custom, i32 0, i32 0
707 // CHECK-NEXT: store ptr {{.*}}, ptr %[[N]], align [[ALIGN]]
708 // CHECK-NOT: !annotation
709 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
711 TEST_UNINIT(padded, padded);
712 // CHECK-LABEL: @test_padded_uninit()
713 // CHECK: %uninit = alloca %struct.padded, align
714 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
715 // PATTERN-LABEL: @test_padded_uninit()
716 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_padded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
717 // PATTERN-O1: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
718 // ZERO-LABEL: @test_padded_uninit()
719 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
720 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
722 TEST_BRACES(padded, padded);
723 // CHECK-LABEL: @test_padded_braces()
724 // CHECK: %braces = alloca %struct.padded, align [[ALIGN:[0-9]*]]
725 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
726 // CHECK-NOT: !annotation
727 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
729 TEST_CUSTOM(padded, padded, { 42, 13371337 });
730 // CHECK-LABEL: @test_padded_custom()
731 // CHECK: %custom = alloca %struct.padded, align
732 // CHECK-NEXT: call void @llvm.memcpy
733 // CHECK-NOT: !annotation
734 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
736 TEST_UNINIT(paddednullinit, paddednullinit);
737 // CHECK-LABEL: @test_paddednullinit_uninit()
738 // CHECK: %uninit = alloca %struct.paddednullinit, align
739 // CHECK-NEXT: call void @{{.*}}paddednullinit{{.*}}%uninit)
740 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
741 // PATTERN-LABEL: @test_paddednullinit_uninit()
742 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednullinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
743 // PATTERN-O1: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
744 // ZERO-LABEL: @test_paddednullinit_uninit()
745 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.*}}, !annotation [[AUTO_INIT]]
746 // ZERO-O1: store i64 0, ptr %uninit, align 8
747 // FIXME: !annotation dropped by optimizations
748 // ZERO-O1-NOT: !annotation
749 // ZERO: ret
752 TEST_BRACES(paddednullinit, paddednullinit);
753 // CHECK-LABEL: @test_paddednullinit_braces()
754 // CHECK: %braces = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
755 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, ptr %braces, i32 0, i32 0
756 // CHECK-NEXT: store i8 0, ptr %[[C]], align [[ALIGN]]
757 // CHECK-NOT: !annotation
758 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, ptr %braces, i32 0, i32 1
759 // CHECK-NEXT: store i32 0, ptr %[[I]], align [[ALIGN]]
760 // CHECK-NOT: !annotation
761 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
763 TEST_CUSTOM(paddednullinit, paddednullinit, { 42, 13371337 });
764 // CHECK-LABEL: @test_paddednullinit_custom()
765 // CHECK: %custom = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
766 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, ptr %custom, i32 0, i32 0
767 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
768 // CHECK-NOT: !annotation
769 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, ptr %custom, i32 0, i32 1
770 // CHECK-NEXT: store i32 13371337, ptr %[[I]], align [[ALIGN]]
771 // CHECK-NOT: !annotation
772 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
774 TEST_UNINIT(paddedpacked, paddedpacked);
775 // CHECK-LABEL: @test_paddedpacked_uninit()
776 // CHECK: %uninit = alloca %struct.paddedpacked, align
777 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
778 // PATTERN-LABEL: @test_paddedpacked_uninit()
779 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpacked_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
780 // PATTERN-O1: store i8 [[I8]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
781 // PATTERN-O1: %[[I:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 1
782 // PATTERN-O1: store i32 [[I32]], ptr %[[I]], align {{.+}}, !annotation [[AUTO_INIT]]
784 // ZERO-LABEL: @test_paddedpacked_uninit()
785 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
787 TEST_BRACES(paddedpacked, paddedpacked);
788 // CHECK-LABEL: @test_paddedpacked_braces()
789 // CHECK: %braces = alloca %struct.paddedpacked, align [[ALIGN:[0-9]*]]
790 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 5, i1 false)
791 // CHECK-NOT: !annotation
792 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
794 TEST_CUSTOM(paddedpacked, paddedpacked, { 42, 13371337 });
795 // CHECK-LABEL: @test_paddedpacked_custom()
796 // CHECK: %custom = alloca %struct.paddedpacked, align
797 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpacked_custom.custom
798 // CHECK-NOT: !annotation
799 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
801 TEST_UNINIT(paddedpackedarray, paddedpackedarray);
802 // CHECK-LABEL: @test_paddedpackedarray_uninit()
803 // CHECK: %uninit = alloca %struct.paddedpackedarray, align
804 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
805 // PATTERN-LABEL: @test_paddedpackedarray_uninit()
806 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackedarray_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
807 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}i8 [[I8]], i64 10
808 // FIXME: !annotation dropped by optimizations
809 // PATTERN-O1-NOT: !annotation
810 // ZERO-LABEL: @test_paddedpackedarray_uninit()
811 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
813 TEST_BRACES(paddedpackedarray, paddedpackedarray);
814 // CHECK-LABEL: @test_paddedpackedarray_braces()
815 // CHECK: %braces = alloca %struct.paddedpackedarray, align [[ALIGN:[0-9]*]]
816 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
817 // CHECK-NOT: !annotation
818 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
820 TEST_CUSTOM(paddedpackedarray, paddedpackedarray, { {{ 42, 13371337 }, { 43, 13371338 }} });
821 // CHECK-LABEL: @test_paddedpackedarray_custom()
822 // CHECK: %custom = alloca %struct.paddedpackedarray, align
823 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackedarray_custom.custom
824 // CHECK-NOT: !annotation
825 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
827 TEST_UNINIT(unpackedinpacked, unpackedinpacked);
828 // PATTERN-LABEL: @test_unpackedinpacked_uninit()
829 // PATTERN-O0: call void @llvm.memcpy{{.*}} 9, i1 false), !annotation [[AUTO_INIT]]
831 TEST_UNINIT(paddednested, paddednested);
832 // CHECK-LABEL: @test_paddednested_uninit()
833 // CHECK: %uninit = alloca %struct.paddednested, align
834 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
835 // PATTERN-LABEL: @test_paddednested_uninit()
836 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
837 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16{{.+}})
838 // FIXME: !annotation dropped by optimizations
839 // PATTERN-O1-NOT: !annotation
840 // ZERO-LABEL: @test_paddednested_uninit()
841 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
843 TEST_BRACES(paddednested, paddednested);
844 // CHECK-LABEL: @test_paddednested_braces()
845 // CHECK: %braces = alloca %struct.paddednested, align [[ALIGN:[0-9]*]]
846 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
847 // CHECK-NOT: !annotation
848 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
850 TEST_CUSTOM(paddednested, paddednested, { { 42, 13371337 }, { 43, 13371338 } });
851 // CHECK-LABEL: @test_paddednested_custom()
852 // CHECK: %custom = alloca %struct.paddednested, align
853 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddednested_custom.custom
854 // CHECK-NOT: !annotation
855 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
857 TEST_UNINIT(paddedpackednested, paddedpackednested);
858 // CHECK-LABEL: @test_paddedpackednested_uninit()
859 // CHECK: %uninit = alloca %struct.paddedpackednested, align
860 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
861 // PATTERN-LABEL: @test_paddedpackednested_uninit()
862 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
863 // PATTERN-O1: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(10) %uninit, i8 [[I8]], i64 10, i1 false)
864 // FIXME: !annotation dropped by optimizations
865 // PATTERN-O1-NOT: !annotation
866 // ZERO-LABEL: @test_paddedpackednested_uninit()
867 // ZERO: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
869 TEST_BRACES(paddedpackednested, paddedpackednested);
870 // CHECK-LABEL: @test_paddedpackednested_braces()
871 // CHECK: %braces = alloca %struct.paddedpackednested, align [[ALIGN:[0-9]*]]
872 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
873 // CHECK-NOT: !annotation
874 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
876 TEST_CUSTOM(paddedpackednested, paddedpackednested, { { 42, 13371337 }, { 43, 13371338 } });
877 // CHECK-LABEL: @test_paddedpackednested_custom()
878 // CHECK: %custom = alloca %struct.paddedpackednested, align
879 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackednested_custom.custom
880 // CHECK-NOT: !annotation
881 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
883 TEST_UNINIT(bitfield, bitfield);
884 // CHECK-LABEL: @test_bitfield_uninit()
885 // CHECK: %uninit = alloca %struct.bitfield, align
886 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
887 // PATTERN-LABEL: @test_bitfield_uninit()
888 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfield_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
889 // PATTERN-O1: store i32 [[I32]], ptr %uninit, align 4
890 // FIXME: !annotation dropped by optimizations
891 // PATTERN-O1-NOT: !annotation
892 // ZERO-LABEL: @test_bitfield_uninit()
893 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0{{.+}}), !annotation [[AUTO_INIT]]
894 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
896 TEST_BRACES(bitfield, bitfield);
897 // CHECK-LABEL: @test_bitfield_braces()
898 // CHECK: %braces = alloca %struct.bitfield, align
899 // CHECK-NEXT: call void @llvm.memcpy
900 // CHECK-NOT: !annotation
901 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
903 TEST_CUSTOM(bitfield, bitfield, { 4, 1 });
904 // CHECK-LABEL: @test_bitfield_custom()
905 // CHECK: %custom = alloca %struct.bitfield, align
906 // CHECK-NEXT: call void @llvm.memcpy
907 // CHECK-NOT: !annotation
908 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
910 TEST_UNINIT(bitfieldaligned, bitfieldaligned);
911 // CHECK-LABEL: @test_bitfieldaligned_uninit()
912 // CHECK: %uninit = alloca %struct.bitfieldaligned, align
913 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
914 // PATTERN-LABEL: @test_bitfieldaligned_uninit()
915 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfieldaligned_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
916 // PATTERN-O1: store i64 [[IPTR]], ptr %uninit, align 8
917 // FIXME: !annotation dropped by optimizations
918 // PATTERN-O1-NOT: !annotation
919 // ZERO-LABEL: @test_bitfieldaligned_uninit()
920 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
921 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
923 TEST_BRACES(bitfieldaligned, bitfieldaligned);
924 // CHECK-LABEL: @test_bitfieldaligned_braces()
925 // CHECK: %braces = alloca %struct.bitfieldaligned, align
926 // CHECK-NEXT: call void @llvm.memcpy
927 // CHECK-NOT: !annotation
928 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
930 TEST_CUSTOM(bitfieldaligned, bitfieldaligned, { 4, 1 });
931 // CHECK-LABEL: @test_bitfieldaligned_custom()
932 // CHECK: %custom = alloca %struct.bitfieldaligned, align
933 // CHECK-NEXT: call void @llvm.memcpy
934 // CHECK-NOT: !annotation
935 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
937 TEST_UNINIT(big, big);
938 // CHECK-LABEL: @test_big_uninit()
939 // CHECK: %uninit = alloca %struct.big, align
940 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
941 // PATTERN-LABEL: @test_big_uninit()
942 // PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
943 // ZERO-LABEL: @test_big_uninit()
944 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
946 TEST_BRACES(big, big);
947 // CHECK-LABEL: @test_big_braces()
948 // CHECK: %braces = alloca %struct.big, align [[ALIGN:[0-9]*]]
949 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 104, i1 false)
950 // CHECK-NOT: !annotation
951 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
953 TEST_CUSTOM(big, big, { 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA, 0xAAAAAAAA });
954 // CHECK-LABEL: @test_big_custom()
955 // CHECK: %custom = alloca %struct.big, align [[ALIGN:[0-9]*]]
956 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 -86, i64 104, i1 false)
957 // CHECK-NOT: !annotation
958 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
960 TEST_UNINIT(arraytail, arraytail);
961 // CHECK-LABEL: @test_arraytail_uninit()
962 // CHECK: %uninit = alloca %struct.arraytail, align
963 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
964 // PATTERN-LABEL: @test_arraytail_uninit()
965 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_arraytail_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
966 // PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
967 // ZERO-LABEL: @test_arraytail_uninit()
968 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
969 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
971 TEST_BRACES(arraytail, arraytail);
972 // CHECK-LABEL: @test_arraytail_braces()
973 // CHECK: %braces = alloca %struct.arraytail, align [[ALIGN:[0-9]*]]
974 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
975 // CHECK-NOT: !annotation
976 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
978 TEST_CUSTOM(arraytail, arraytail, { 0xdead });
979 // CHECK-LABEL: @test_arraytail_custom()
980 // CHECK: %custom = alloca %struct.arraytail, align
981 // CHECK-NEXT: call void @llvm.memcpy
982 // CHECK-NOT: !annotation
983 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
985 TEST_UNINIT(int0, int[0]);
986 // CHECK-LABEL: @test_int0_uninit()
987 // CHECK: %uninit = alloca [0 x i32], align
988 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
989 // PATTERN-LABEL: @test_int0_uninit()
990 // PATTERN: %uninit = alloca [0 x i32], align
991 // PATTERN-O0-NEXT: call void @{{.*}}used{{.*}}%uninit)
992 // ZERO-LABEL: @test_int0_uninit()
993 // ZERO: %uninit = alloca [0 x i32], align
994 // ZERO-O0-NEXT: call void @{{.*}}used{{.*}}%uninit)
996 TEST_BRACES(int0, int[0]);
997 // CHECK-LABEL: @test_int0_braces()
998 // CHECK: %braces = alloca [0 x i32], align [[ALIGN:[0-9]*]]
999 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1001 TEST_UNINIT(int1, int[1]);
1002 // CHECK-LABEL: @test_int1_uninit()
1003 // CHECK: %uninit = alloca [1 x i32], align [[ALIGN:[0-9]*]]
1004 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1005 // PATTERN-LABEL: @test_int1_uninit()
1006 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_int1_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1007 // PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
1008 // ZERO-LABEL: @test_int1_uninit()
1009 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1010 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1012 TEST_BRACES(int1, int[1]);
1013 // CHECK-LABEL: @test_int1_braces()
1014 // CHECK: %braces = alloca [1 x i32], align [[ALIGN:[0-9]*]]
1015 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1016 // CHECK-NOT: !annotation
1017 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1019 TEST_CUSTOM(int1, int[1], { 0x33333333 });
1020 // CHECK-LABEL: @test_int1_custom()
1021 // CHECK: %custom = alloca [1 x i32], align
1022 // CHECK-NEXT: call void @llvm.memcpy
1023 // CHECK-NOT: !annotation
1024 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1026 TEST_UNINIT(int64, int[64]);
1027 // CHECK-LABEL: @test_int64_uninit()
1028 // CHECK: %uninit = alloca [64 x i32], align
1029 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1030 // PATTERN-LABEL: @test_int64_uninit()
1031 // PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
1032 // ZERO-LABEL: @test_int64_uninit()
1033 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1035 TEST_BRACES(int64, int[64]);
1036 // CHECK-LABEL: @test_int64_braces()
1037 // CHECK: %braces = alloca [64 x i32], align [[ALIGN:[0-9]*]]
1038 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 256, i1 false)
1039 // CHECK-NOT: !annotation
1040 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1042 TEST_CUSTOM(int64, int[64], = { 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111, 0x11111111 });
1043 // CHECK-LABEL: @test_int64_custom()
1044 // CHECK: %custom = alloca [64 x i32], align [[ALIGN:[0-9]*]]
1045 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 17, i64 256, i1 false)
1046 // CHECK-NOT: !annotation
1047 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1049 TEST_UNINIT(bool4, bool[4]);
1050 // CHECK-LABEL: @test_bool4_uninit()
1051 // CHECK: %uninit = alloca [4 x i8], align
1052 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1053 // PATTERN-LABEL: @test_bool4_uninit()
1054 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bool4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1055 // PATTERN-O1: store i32 [[I32]], ptr %uninit, align 4
1056 // FIXME: !annotation dropped by optimizations
1057 // PATTERN-O1-NOT: !annotation
1058 // ZERO-LABEL: @test_bool4_uninit()
1059 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1060 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1062 TEST_BRACES(bool4, bool[4]);
1063 // CHECK-LABEL: @test_bool4_braces()
1064 // CHECK: %braces = alloca [4 x i8], align [[ALIGN:[0-9]*]]
1065 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1066 // CHECK-NOT: !annotation
1067 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1069 TEST_CUSTOM(bool4, bool[4], { true, true, true, true });
1070 // CHECK-LABEL: @test_bool4_custom()
1071 // CHECK: %custom = alloca [4 x i8], align
1072 // CHECK-NEXT: call void @llvm.memcpy
1073 // CHECK-NOT: !annotation
1074 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1076 TEST_UNINIT(intptr4, int*[4]);
1077 // CHECK-LABEL: @test_intptr4_uninit()
1078 // CHECK: %uninit = alloca [4 x ptr], align
1079 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1080 // PATTERN-O1-LABEL: @test_intptr4_uninit()
1081 // PATTERN-O1: call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %{{.*}}, i8 -86, i64 32, i1 false)
1082 // FIXME: !annotation dropped by optimizations
1083 // PATTERN-O1-NOT: !annotation
1084 // ZERO-LABEL: @test_intptr4_uninit()
1085 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1087 TEST_BRACES(intptr4, int*[4]);
1088 // CHECK-LABEL: @test_intptr4_braces()
1089 // CHECK: %braces = alloca [4 x ptr], align [[ALIGN:[0-9]*]]
1090 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 32, i1 false)
1091 // CHECK-NOT: !annotation
1092 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1094 TEST_CUSTOM(intptr4, int *[4], = {(int *)0x22222222, (int *)0x22222222, (int *)0x22222222, (int *)0x22222222});
1095 // CHECK-LABEL: @test_intptr4_custom()
1096 // CHECK: %custom = alloca [4 x ptr], align
1097 // CHECK-NEXT: call void @llvm.memcpy
1098 // CHECK-NOT: !annotation
1099 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1101 TEST_UNINIT(tailpad4, tailpad[4]);
1102 // CHECK-LABEL: @test_tailpad4_uninit()
1103 // CHECK: %uninit = alloca [4 x %struct.tailpad], align
1104 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1105 // PATTERN-LABEL: @test_tailpad4_uninit()
1106 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_tailpad4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1107 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16{{.+}})
1108 // FIXME: !annotation dropped by optimizations
1109 // PATTERN-O1-NOT: !annotation
1110 // ZERO-LABEL: @test_tailpad4_uninit()
1111 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1113 TEST_BRACES(tailpad4, tailpad[4]);
1114 // CHECK-LABEL: @test_tailpad4_braces()
1115 // CHECK: %braces = alloca [4 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1116 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
1117 // CHECK-NOT: !annotation
1118 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1120 TEST_CUSTOM(tailpad4, tailpad[4], { {257, 1}, {257, 1}, {257, 1}, {257, 1} });
1121 // CHECK-LABEL: @test_tailpad4_custom()
1122 // CHECK: %custom = alloca [4 x %struct.tailpad], align
1123 // CHECK-NEXT: call void @llvm.memcpy
1124 // CHECK-NOT: !annotation
1125 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1127 TEST_UNINIT(tailpad9, tailpad[9]);
1128 // CHECK-LABEL: @test_tailpad9_uninit()
1129 // CHECK: %uninit = alloca [9 x %struct.tailpad], align
1130 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1131 // PATTERN-LABEL: @test_tailpad9_uninit()
1132 // PATTERN-O0: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
1133 // ZERO-LABEL: @test_tailpad9_uninit()
1134 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1136 TEST_BRACES(tailpad9, tailpad[9]);
1137 // CHECK-LABEL: @test_tailpad9_braces()
1138 // CHECK: %braces = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1139 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 36, i1 false)
1140 // CHECK-NOT: !annotation
1141 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1143 TEST_CUSTOM(tailpad9, tailpad[9], { {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1} });
1144 // CHECK-LABEL: @test_tailpad9_custom()
1145 // CHECK: %custom = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1146 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 1, i64 36, i1 false)
1147 // CHECK-NOT: !annotation
1148 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1150 TEST_UNINIT(atomicbool, _Atomic(bool));
1151 // CHECK-LABEL: @test_atomicbool_uninit()
1152 // CHECK: %uninit = alloca i8, align
1153 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1154 // PATTERN-LABEL: @test_atomicbool_uninit()
1155 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
1156 // ZERO-LABEL: @test_atomicbool_uninit()
1157 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
1159 TEST_UNINIT(atomicint, _Atomic(int));
1160 // CHECK-LABEL: @test_atomicint_uninit()
1161 // CHECK: %uninit = alloca i32, align
1162 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1163 // PATTERN-LABEL: @test_atomicint_uninit()
1164 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1165 // ZERO-LABEL: @test_atomicint_uninit()
1166 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1168 TEST_UNINIT(atomicdouble, _Atomic(double));
1169 // CHECK-LABEL: @test_atomicdouble_uninit()
1170 // CHECK: %uninit = alloca double, align
1171 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1172 // PATTERN-LABEL: @test_atomicdouble_uninit()
1173 // PATTERN: store double 0xFFFFFFFFFFFFFFFF, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1174 // ZERO-LABEL: @test_atomicdouble_uninit()
1175 // ZERO: store double 0.000000e+00, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1177 TEST_UNINIT(atomicnotlockfree, _Atomic(notlockfree));
1178 // CHECK-LABEL: @test_atomicnotlockfree_uninit()
1179 // CHECK: %uninit = alloca %struct.notlockfree, align
1180 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1181 // PATTERN-LABEL: @test_atomicnotlockfree_uninit()
1182 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicnotlockfree_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1183 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 32{{.*}}
1184 // FIXME: !annotation dropped by optimizations
1185 // PATTERN-O1-NOT: !annotation
1186 // ZERO-LABEL: @test_atomicnotlockfree_uninit()
1187 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1189 TEST_UNINIT(atomicpadded, _Atomic(padded));
1190 // CHECK-LABEL: @test_atomicpadded_uninit()
1191 // CHECK: %uninit = alloca %struct.padded, align
1192 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1193 // PATTERN-LABEL: @test_atomicpadded_uninit()
1194 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicpadded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1195 // PATTERN-O1: store i64 [[IPTR]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1196 // ZERO-LABEL: @test_atomicpadded_uninit()
1197 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1198 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1200 TEST_UNINIT(atomictailpad, _Atomic(tailpad));
1201 // CHECK-LABEL: @test_atomictailpad_uninit()
1202 // CHECK: %uninit = alloca %struct.tailpad, align
1203 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1204 // PATTERN-LABEL: @test_atomictailpad_uninit()
1205 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomictailpad_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1206 // ZERO-LABEL: @test_atomictailpad_uninit()
1207 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1208 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1210 TEST_UNINIT(complexfloat, _Complex float);
1211 // CHECK-LABEL: @test_complexfloat_uninit()
1212 // CHECK: %uninit = alloca { float, float }, align
1213 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1214 // PATTERN-LABEL: @test_complexfloat_uninit()
1215 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexfloat_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1216 // PATTERN-O1: store float 0xFFFFFFFFE0000000, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
1218 // PATTERN-O1: %[[F2:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 0, i32 1
1219 // PATTERN-O1: store float 0xFFFFFFFFE0000000, ptr %[[F2]], align {{.+}}, !annotation [[AUTO_INIT]]
1221 // ZERO-LABEL: @test_complexfloat_uninit()
1222 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1223 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1225 TEST_BRACES(complexfloat, _Complex float);
1226 // CHECK-LABEL: @test_complexfloat_braces()
1227 // CHECK: %braces = alloca { float, float }, align [[ALIGN:[0-9]*]]
1228 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { float, float }, ptr %braces, i32 0, i32 0
1229 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { float, float }, ptr %braces, i32 0, i32 1
1230 // CHECK-NEXT: store float 0.000000e+00, ptr %[[R]], align [[ALIGN]]
1231 // CHECK-NOT: !annotation
1232 // CHECK-NEXT: store float 0.000000e+00, ptr %[[I]], align [[ALIGN]]
1233 // CHECK-NOT: !annotation
1234 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1236 TEST_CUSTOM(complexfloat, _Complex float, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
1237 // CHECK-LABEL: @test_complexfloat_custom()
1238 // CHECK: %custom = alloca { float, float }, align [[ALIGN:[0-9]*]]
1239 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { float, float }, ptr %custom, i32 0, i32 0
1240 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { float, float }, ptr %custom, i32 0, i32 1
1241 // CHECK-NEXT: store float 0x400921FB60000000, ptr %[[R]], align [[ALIGN]]
1242 // CHECK-NOT: !annotation
1243 // CHECK-NEXT: store float 0x400921FB60000000, ptr %[[I]], align [[ALIGN]]
1244 // CHECK-NOT: !annotation
1245 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1247 TEST_UNINIT(complexdouble, _Complex double);
1248 // CHECK-LABEL: @test_complexdouble_uninit()
1249 // CHECK: %uninit = alloca { double, double }, align
1250 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1251 // PATTERN-LABEL: @test_complexdouble_uninit()
1252 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexdouble_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1253 // ZERO-LABEL: @test_complexdouble_uninit()
1254 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1256 TEST_BRACES(complexdouble, _Complex double);
1257 // CHECK-LABEL: @test_complexdouble_braces()
1258 // CHECK: %braces = alloca { double, double }, align [[ALIGN:[0-9]*]]
1259 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { double, double }, ptr %braces, i32 0, i32 0
1260 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { double, double }, ptr %braces, i32 0, i32 1
1261 // CHECK-NEXT: store double 0.000000e+00, ptr %[[R]], align [[ALIGN]]
1262 // CHECK-NOT: !annotation
1263 // CHECK-NEXT: store double 0.000000e+00, ptr %[[I]], align [[ALIGN]]
1264 // CHECK-NOT: !annotation
1265 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1267 TEST_CUSTOM(complexdouble, _Complex double, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
1268 // CHECK-LABEL: @test_complexdouble_custom()
1269 // CHECK: %custom = alloca { double, double }, align [[ALIGN:[0-9]*]]
1270 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { double, double }, ptr %custom, i32 0, i32 0
1271 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { double, double }, ptr %custom, i32 0, i32 1
1272 // CHECK-NEXT: store double 0x400921FB54442D18, ptr %[[R]], align [[ALIGN]]
1273 // CHECK-NOT: !annotation
1274 // CHECK-NEXT: store double 0x400921FB54442D18, ptr %[[I]], align [[ALIGN]]
1275 // CHECK-NOT: !annotation
1276 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1278 TEST_UNINIT(volatileint, volatile int);
1279 // CHECK-LABEL: @test_volatileint_uninit()
1280 // CHECK: %uninit = alloca i32, align
1281 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1282 // PATTERN-LABEL: @test_volatileint_uninit()
1283 // PATTERN: store volatile i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1284 // ZERO-LABEL: @test_volatileint_uninit()
1285 // ZERO: store volatile i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1287 TEST_BRACES(volatileint, volatile int);
1288 // CHECK-LABEL: @test_volatileint_braces()
1289 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1290 // CHECK-NEXT: store volatile i32 0, ptr %braces, align [[ALIGN]]
1291 // CHECK-NOT: !annotation
1292 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1294 TEST_UNINIT(semivolatile, semivolatile);
1295 // CHECK-LABEL: @test_semivolatile_uninit()
1296 // CHECK: %uninit = alloca %struct.semivolatile, align
1297 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1298 // PATTERN-LABEL: @test_semivolatile_uninit()
1299 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_semivolatile_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1300 // ZERO-LABEL: @test_semivolatile_uninit()
1301 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1302 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1304 TEST_BRACES(semivolatile, semivolatile);
1305 // CHECK-LABEL: @test_semivolatile_braces()
1306 // CHECK: %braces = alloca %struct.semivolatile, align [[ALIGN:[0-9]*]]
1307 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1308 // CHECK-NOT: !annotation
1309 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1311 TEST_CUSTOM(semivolatile, semivolatile, { 0x44444444, 0x44444444 });
1312 // CHECK-LABEL: @test_semivolatile_custom()
1313 // CHECK: %custom = alloca %struct.semivolatile, align
1314 // CHECK-O0: call void @llvm.memcpy
1315 // CHECK-NOT: !annotation
1316 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1317 // CHECK-O1: store i64 4919131752989213764, ptr %custom, align 8
1318 // CHECK-NOT: !annotation
1320 TEST_UNINIT(semivolatileinit, semivolatileinit);
1321 // CHECK-LABEL: @test_semivolatileinit_uninit()
1322 // CHECK: %uninit = alloca %struct.semivolatileinit, align
1323 // CHECK-NEXT: call void @{{.*}}semivolatileinit{{.*}}%uninit)
1324 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1326 TEST_BRACES(semivolatileinit, semivolatileinit);
1327 // CHECK-LABEL: @test_semivolatileinit_braces()
1328 // CHECK: %braces = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
1329 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, ptr %braces, i32 0, i32 0
1330 // CHECK-NEXT: store i32 286331153, ptr %[[I]], align [[ALIGN]]
1331 // CHECK-NOT: !annotation
1332 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, ptr %braces, i32 0, i32 1
1333 // CHECK-NEXT: store volatile i32 286331153, ptr %[[VI]], align [[ALIGN]]
1334 // CHECK-NOT: !annotation
1335 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1337 TEST_CUSTOM(semivolatileinit, semivolatileinit, { 0x44444444, 0x44444444 });
1338 // CHECK-LABEL: @test_semivolatileinit_custom()
1339 // CHECK: %custom = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
1340 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, ptr %custom, i32 0, i32 0
1341 // CHECK-NEXT: store i32 1145324612, ptr %[[I]], align [[ALIGN]]
1342 // CHECK-NOT: !annotation
1343 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, ptr %custom, i32 0, i32 1
1344 // CHECK-NEXT: store volatile i32 1145324612, ptr %[[VI]], align [[ALIGN]]
1345 // CHECK-NOT: !annotation
1346 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1348 TEST_UNINIT(base, base);
1349 // CHECK-LABEL: @test_base_uninit()
1350 // CHECK: %uninit = alloca %struct.base, align
1351 // CHECK-NEXT: call void @{{.*}}base{{.*}}%uninit)
1352 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1353 // PATTERN-LABEL: @test_base_uninit()
1354 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_base_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1355 // ZERO-LABEL: @test_base_uninit()
1356 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1357 // ZERO-O1: store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV4base, i64 0, inrange i32 0, i64 2), {{.*}}, align 8
1358 // ZERO-O1-NOT: !annotation
1360 TEST_BRACES(base, base);
1361 // CHECK-LABEL: @test_base_braces()
1362 // CHECK: %braces = alloca %struct.base, align [[ALIGN:[0-9]*]]
1363 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1364 // CHECK-NOT: !annotation
1365 // CHECK-NEXT: call void @{{.*}}base{{.*}}%braces)
1366 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1368 TEST_UNINIT(derived, derived);
1369 // CHECK-LABEL: @test_derived_uninit()
1370 // CHECK: %uninit = alloca %struct.derived, align
1371 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%uninit)
1372 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1373 // PATTERN-LABEL: @test_derived_uninit()
1374 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_derived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1375 // ZERO-LABEL: @test_derived_uninit()
1376 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1377 // ZERO-O1: store i64 0, {{.*}} align 8, !annotation [[AUTO_INIT]]
1378 // ZERO-O1: store ptr getelementptr inbounds ({ [4 x ptr] }, ptr @_ZTV7derived, i64 0, inrange i32 0, i64 2), {{.*}} align 8
1380 TEST_BRACES(derived, derived);
1381 // CHECK-LABEL: @test_derived_braces()
1382 // CHECK: %braces = alloca %struct.derived, align [[ALIGN:[0-9]*]]
1383 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1384 // CHECK-NOT: !annotation
1385 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%braces)
1386 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1388 TEST_UNINIT(virtualderived, virtualderived);
1389 // CHECK-LABEL: @test_virtualderived_uninit()
1390 // CHECK: %uninit = alloca %struct.virtualderived, align
1391 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%uninit)
1392 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1393 // PATTERN-LABEL: @test_virtualderived_uninit()
1394 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_virtualderived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1395 // ZERO-LABEL: @test_virtualderived_uninit()
1396 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1397 // ZERO-O1: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1399 TEST_BRACES(virtualderived, virtualderived);
1400 // CHECK-LABEL: @test_virtualderived_braces()
1401 // CHECK: %braces = alloca %struct.virtualderived, align [[ALIGN:[0-9]*]]
1402 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
1403 // CHECK-NOT: !annotation
1404 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%braces)
1405 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1407 TEST_UNINIT(matching, matching);
1408 // CHECK-LABEL: @test_matching_uninit()
1409 // CHECK: %uninit = alloca %union.matching, align
1410 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1411 // PATTERN-LABEL: @test_matching_uninit()
1412 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matching_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1413 // ZERO-LABEL: @test_matching_uninit()
1414 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1415 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1417 TEST_BRACES(matching, matching);
1418 // CHECK-LABEL: @test_matching_braces()
1419 // CHECK: %braces = alloca %union.matching, align [[ALIGN:[0-9]*]]
1420 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1421 // CHECK-NOT: !annotation
1422 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1424 TEST_CUSTOM(matching, matching, { .f = 0xf00f });
1425 // CHECK-LABEL: @test_matching_custom()
1426 // CHECK: %custom = alloca %union.matching, align
1427 // CHECK-O0: call void @llvm.memcpy
1428 // CHECK-NOT: !annotation
1429 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1430 // CHECK-O1: store i32 1198526208, ptr {{.*}}, align 4
1431 // CHECK-NOT: !annotation
1433 TEST_UNINIT(matchingreverse, matchingreverse);
1434 // CHECK-LABEL: @test_matchingreverse_uninit()
1435 // CHECK: %uninit = alloca %union.matchingreverse, align
1436 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1437 // PATTERN-LABEL: @test_matchingreverse_uninit()
1438 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matchingreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1439 // PATTERN-O1: store float 0xFFFFFFFFE0000000, {{.+}}, !annotation [[AUTO_INIT]]
1440 // ZERO-LABEL: @test_matchingreverse_uninit()
1441 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1442 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1444 TEST_BRACES(matchingreverse, matchingreverse);
1445 // CHECK-LABEL: @test_matchingreverse_braces()
1446 // CHECK: %braces = alloca %union.matchingreverse, align [[ALIGN:[0-9]*]]
1447 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1448 // CHECK-NOT: !annotation
1449 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1451 TEST_CUSTOM(matchingreverse, matchingreverse, { .i = 0xf00f });
1452 // CHECK-LABEL: @test_matchingreverse_custom()
1453 // CHECK: %custom = alloca %union.matchingreverse, align
1454 // CHECK-O0: call void @llvm.memcpy
1455 // CHECK-NOT: !annotation
1456 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1457 // CHECK-O1: store i32 61455, ptr %custom, align 4
1458 // CHECK-NOT: !annotation
1460 TEST_UNINIT(unmatched, unmatched);
1461 // CHECK-LABEL: @test_unmatched_uninit()
1462 // CHECK: %uninit = alloca %union.unmatched, align
1463 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1464 // PATTERN-LABEL: @test_unmatched_uninit()
1465 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatched_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1466 // ZERO-LABEL: @test_unmatched_uninit()
1467 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1468 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1470 TEST_BRACES(unmatched, unmatched);
1471 // CHECK-LABEL: @test_unmatched_braces()
1472 // CHECK: %braces = alloca %union.unmatched, align
1473 // CHECK-NEXT: call void @llvm.memcpy
1474 // CHECK-NOT: !annotation
1475 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1477 TEST_CUSTOM(unmatched, unmatched, { .i = 0x3badbeef });
1478 // CHECK-LABEL: @test_unmatched_custom()
1479 // CHECK: %custom = alloca %union.unmatched, align
1480 // CHECK-O0: call void @llvm.memcpy
1481 // CHECK-NOT: !annotation
1482 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1483 // CHECK-O1: store i32 1001242351, ptr {{.*}}, align 4
1484 // CHECK-NOT: !annotation
1486 TEST_UNINIT(unmatchedreverse, unmatchedreverse);
1487 // CHECK-LABEL: @test_unmatchedreverse_uninit()
1488 // CHECK: %uninit = alloca %union.unmatchedreverse, align
1489 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1490 // PATTERN-LABEL: @test_unmatchedreverse_uninit()
1491 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1492 // ZERO-LABEL: @test_unmatchedreverse_uninit()
1493 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1494 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1496 TEST_BRACES(unmatchedreverse, unmatchedreverse);
1497 // CHECK-LABEL: @test_unmatchedreverse_braces()
1498 // CHECK: %braces = alloca %union.unmatchedreverse, align [[ALIGN:[0-9]*]]
1499 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1500 // CHECK-NOT: !annotation
1501 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1503 TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42 });
1504 // CHECK-LABEL: @test_unmatchedreverse_custom()
1505 // CHECK: %custom = alloca %union.unmatchedreverse, align
1506 // CHECK-O0: call void @llvm.memcpy
1507 // CHECK-NOT: !annotation
1508 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1509 // PATTERN-O1: store i32 -1431655894, ptr {{.*}}, align 4
1510 // ZERO-O1: store i32 42, ptr {{.*}}, align 4
1512 TEST_UNINIT(unmatchedfp, unmatchedfp);
1513 // CHECK-LABEL: @test_unmatchedfp_uninit()
1514 // CHECK: %uninit = alloca %union.unmatchedfp, align
1515 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1516 // PATTERN-LABEL: @test_unmatchedfp_uninit()
1517 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedfp_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1518 // ZERO-LABEL: @test_unmatchedfp_uninit()
1519 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1520 // ZERO-O1: store i64 0, {{.*}} align 8, !annotation [[AUTO_INIT]]
1522 TEST_BRACES(unmatchedfp, unmatchedfp);
1523 // CHECK-LABEL: @test_unmatchedfp_braces()
1524 // CHECK: %braces = alloca %union.unmatchedfp, align
1525 // CHECK-NEXT: call void @llvm.memcpy
1526 // CHECK-NOT: !annotation
1527 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1529 TEST_CUSTOM(unmatchedfp, unmatchedfp, { .d = 3.1415926535897932384626433 });
1530 // CHECK-LABEL: @test_unmatchedfp_custom()
1531 // CHECK: %custom = alloca %union.unmatchedfp, align
1532 // CHECK-O0: call void @llvm.memcpy
1533 // CHECK-NOT: !annotation
1534 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1535 // CHECK-O1: store i64 4614256656552045848, ptr %custom, align 8
1536 // CHECK-NOT: !annotation
1538 TEST_UNINIT(emptyenum, emptyenum);
1539 // CHECK-LABEL: @test_emptyenum_uninit()
1540 // CHECK: %uninit = alloca i32, align
1541 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1542 // PATTERN-LABEL: @test_emptyenum_uninit()
1543 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1544 // ZERO-LABEL: @test_emptyenum_uninit()
1545 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1547 TEST_BRACES(emptyenum, emptyenum);
1548 // CHECK-LABEL: @test_emptyenum_braces()
1549 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1550 // CHECK-NOT: !annotation
1551 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
1552 // CHECK-NOT: !annotation
1553 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1555 TEST_CUSTOM(emptyenum, emptyenum, { (emptyenum)42 });
1556 // CHECK-LABEL: @test_emptyenum_custom()
1557 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]]
1558 // CHECK-NEXT: store i32 42, ptr %custom, align [[ALIGN]]
1559 // CHECK-NOT: !annotation
1560 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1562 TEST_UNINIT(smallenum, smallenum);
1563 // CHECK-LABEL: @test_smallenum_uninit()
1564 // CHECK: %uninit = alloca i32, align
1565 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1566 // PATTERN-LABEL: @test_smallenum_uninit()
1567 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1568 // ZERO-LABEL: @test_smallenum_uninit()
1569 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1571 TEST_BRACES(smallenum, smallenum);
1572 // CHECK-LABEL: @test_smallenum_braces()
1573 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1574 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
1575 // CHECK-NOT: !annotation
1576 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1578 TEST_CUSTOM(smallenum, smallenum, { (smallenum)42 });
1579 // CHECK-LABEL: @test_smallenum_custom()
1580 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]]
1581 // CHECK-NEXT: store i32 42, ptr %custom, align [[ALIGN]]
1582 // CHECK-NOT: !annotation
1583 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1585 TEST_UNINIT(intvec16, int __attribute__((vector_size(16))));
1586 // CHECK-LABEL: @test_intvec16_uninit()
1587 // CHECK: %uninit = alloca <4 x i32>, align
1588 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1589 // PATTERN-LABEL: @test_intvec16_uninit()
1590 // PATTERN: store <4 x i32> <i32 [[I32]], i32 [[I32]], i32 [[I32]], i32 [[I32]]>, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1591 // ZERO-LABEL: @test_intvec16_uninit()
1592 // ZERO: store <4 x i32> zeroinitializer, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1594 TEST_BRACES(intvec16, int __attribute__((vector_size(16))));
1595 // CHECK-LABEL: @test_intvec16_braces()
1596 // CHECK: %braces = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
1597 // CHECK-NEXT: store <4 x i32> zeroinitializer, ptr %braces, align [[ALIGN]]
1598 // CHECK-NOT: !annotation
1599 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1601 TEST_CUSTOM(intvec16, int __attribute__((vector_size(16))), { 0x44444444, 0x44444444, 0x44444444, 0x44444444 });
1602 // CHECK-LABEL: @test_intvec16_custom()
1603 // CHECK: %custom = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
1604 // CHECK-NEXT: store <4 x i32> <i32 1145324612, i32 1145324612, i32 1145324612, i32 1145324612>, ptr %custom, align [[ALIGN]]
1605 // CHECK-NOT: !annotation
1606 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1608 TEST_UNINIT(longlongvec32, long long __attribute__((vector_size(32))));
1609 // CHECK-LABEL: @test_longlongvec32_uninit()
1610 // CHECK: %uninit = alloca <4 x i64>, align
1611 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1612 // PATTERN-LABEL: @test_longlongvec32_uninit()
1613 // PATTERN: store <4 x i64> <i64 [[I64]], i64 [[I64]], i64 [[I64]], i64 [[I64]]>, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1614 // ZERO-LABEL: @test_longlongvec32_uninit()
1615 // ZERO: store <4 x i64> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1617 TEST_BRACES(longlongvec32, long long __attribute__((vector_size(32))));
1618 // CHECK-LABEL: @test_longlongvec32_braces()
1619 // CHECK: %braces = alloca <4 x i64>, align [[ALIGN:[0-9]*]]
1620 // CHECK-NEXT: store <4 x i64> zeroinitializer, ptr %braces, align [[ALIGN]]
1621 // CHECK-NOT: !annotation
1622 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1624 TEST_CUSTOM(longlongvec32, long long __attribute__((vector_size(32))), { 0x3333333333333333, 0x3333333333333333, 0x3333333333333333, 0x3333333333333333 });
1625 // CHECK-LABEL: @test_longlongvec32_custom()
1626 // CHECK: %custom = alloca <4 x i64>, align [[ALIGN:[0-9]*]]
1627 // CHECK-NEXT: store <4 x i64> <i64 3689348814741910323, i64 3689348814741910323, i64 3689348814741910323, i64 3689348814741910323>, ptr %custom, align [[ALIGN]]
1628 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1630 TEST_UNINIT(floatvec16, float __attribute__((vector_size(16))));
1631 // CHECK-LABEL: @test_floatvec16_uninit()
1632 // CHECK: %uninit = alloca <4 x float>, align
1633 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1634 // PATTERN-LABEL: @test_floatvec16_uninit()
1635 // PATTERN: store <4 x float> <float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000>, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1636 // ZERO-LABEL: @test_floatvec16_uninit()
1637 // ZERO: store <4 x float> zeroinitializer, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1639 TEST_BRACES(floatvec16, float __attribute__((vector_size(16))));
1640 // CHECK-LABEL: @test_floatvec16_braces()
1641 // CHECK: %braces = alloca <4 x float>, align [[ALIGN:[0-9]*]]
1642 // CHECK-NEXT: store <4 x float> zeroinitializer, ptr %braces, align [[ALIGN]]
1643 // CHECK-NOT: !annotation
1644 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1646 TEST_CUSTOM(floatvec16, float __attribute__((vector_size(16))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
1647 // CHECK-LABEL: @test_floatvec16_custom()
1648 // CHECK: %custom = alloca <4 x float>, align [[ALIGN:[0-9]*]]
1649 // CHECK-NEXT: store <4 x float> <float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000>, ptr %custom, align [[ALIGN]]
1650 // CHECK-NOT: !annotation
1651 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1653 TEST_UNINIT(doublevec32, double __attribute__((vector_size(32))));
1654 // CHECK-LABEL: @test_doublevec32_uninit()
1655 // CHECK: %uninit = alloca <4 x double>, align
1656 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1657 // PATTERN-LABEL: @test_doublevec32_uninit()
1658 // PATTERN: store <4 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1659 // ZERO-LABEL: @test_doublevec32_uninit()
1660 // ZERO: store <4 x double> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1662 TEST_BRACES(doublevec32, double __attribute__((vector_size(32))));
1663 // CHECK-LABEL: @test_doublevec32_braces()
1664 // CHECK: %braces = alloca <4 x double>, align [[ALIGN:[0-9]*]]
1665 // CHECK-NEXT: store <4 x double> zeroinitializer, ptr %braces, align [[ALIGN]]
1666 // CHECK-NOT: !annotation
1667 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1669 TEST_CUSTOM(doublevec32, double __attribute__((vector_size(32))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
1670 // CHECK-LABEL: @test_doublevec32_custom()
1671 // CHECK: %custom = alloca <4 x double>, align [[ALIGN:[0-9]*]]
1672 // CHECK-NEXT: store <4 x double> <double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18>, ptr %custom, align [[ALIGN]]
1673 // CHECK-NOT: !annotation
1674 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1676 // TODO: This vector has tail padding
1677 TEST_UNINIT(doublevec24, double __attribute__((vector_size(24))));
1678 // CHECK-LABEL: @test_doublevec24_uninit()
1679 // CHECK: %uninit = alloca <3 x double>, align
1680 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1681 // PATTERN-LABEL: @test_doublevec24_uninit()
1682 // PATTERN: store <3 x double> <double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF>, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1683 // ZERO-LABEL: @test_doublevec24_uninit()
1684 // ZERO: store <3 x double> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1686 // TODO: This vector has tail padding
1687 TEST_UNINIT(longdoublevec32, long double __attribute__((vector_size(sizeof(long double)*2))));
1688 // CHECK-LABEL: @test_longdoublevec32_uninit()
1689 // CHECK: %uninit = alloca <2 x x86_fp80>, align
1690 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1691 // PATTERN-LABEL: @test_longdoublevec32_uninit()
1692 // PATTERN: store <2 x x86_fp80> <x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF>, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1693 // ZERO-LABEL: @test_longdoublevec32_uninit()
1694 // ZERO: store <2 x x86_fp80> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1696 } // extern "C"
1698 // PATTERN: [[AUTO_INIT]] = !{!"auto-init"}
1699 // ZERO: [[AUTO_INIT]] = !{!"auto-init"}