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=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=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"
11 char inits
[] = {"-86/-21846/-1431655766/i64/-6148914691236517206/-6148914691236517206/i128/-113427455640312821154458202477256070486/i64/-6148914691236517206/AA/"};
13 char inits
[] = {"-1/-1/-1/i32/-1/-1/i32/-1/i32/-1/FF/"};
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() { \
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 = {}; \
35 #define TEST_CUSTOM(NAME, TYPE, ...) \
36 using type_##NAME = TYPE; \
37 void test_##NAME##_custom() { \
38 type_##NAME custom __VA_ARGS__; \
42 // None of the synthesized globals should contain `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
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 struct paddedpacked
{ char c
; int i
; } __attribute__((packed
));
93 // 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
94 struct paddedpackedarray
{ struct paddedpacked p
[2]; };
95 // 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
96 struct unpackedinpacked
{ padded a
; char b
; } __attribute__((packed
));
97 // 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
98 struct paddednested
{ struct padded p1
, p2
; };
99 // 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
100 struct paddedpackednested
{ struct paddedpacked p1
, p2
; };
101 // PATTERN-O0: @__const.test_bitfield_uninit.uninit = private unnamed_addr constant %struct.bitfield { i8 [[I8]], [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
102 // PATTERN-O0: @__const.test_bitfield_custom.custom = private unnamed_addr constant %struct.bitfield { i8 20, [3 x i8] c"\[[IC]]\[[IC]]\[[IC]]" }, align 4
103 // ZERO-O0: @__const.test_bitfield_custom.custom = private unnamed_addr constant %struct.bitfield { i8 20, [3 x i8] zeroinitializer }, align 4
104 // PATTERN-O1-NOT: @__const.test_bitfield_uninit.uninit
105 // PATTERN-O1-NOT: @__const.test_bitfield_custom.custom
106 // ZERO-O1-NOT: @__const.test_bitfield_custom.custom
107 struct bitfield
{ int i
: 4; int j
: 2; };
108 // 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
109 // 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
110 // 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
111 // PATTERN-O1-NOT: @__const.test_bitfieldaligned_uninit.uninit
112 // PATTERN-O1-NOT: @__const.test_bitfieldaligned_custom.custom
113 // ZERO-O1-NOT: @__const.test_bitfieldaligned_custom.custom
114 struct bitfieldaligned
{ int i
: 4; int : 0; int j
: 2; };
115 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
; };
116 // PATTERN-O0: @__const.test_arraytail_uninit.uninit = private unnamed_addr constant %struct.arraytail { i32 [[I32]], [0 x i32] zeroinitializer }, align 4
117 // PATTERN-O0: @__const.test_arraytail_custom.custom = private unnamed_addr constant %struct.arraytail { i32 57005, [0 x i32] zeroinitializer }, align 4
118 // ZERO-O0: @__const.test_arraytail_custom.custom = private unnamed_addr constant %struct.arraytail { i32 57005, [0 x i32] zeroinitializer }, align 4
119 // PATTERN-O1-NOT: @__const.test_arraytail_uninit.uninit
120 // PATTERN-O1-NOT: @__const.test_arraytail_custom.custom
121 // ZERO-O1-NOT: @__const.test_arraytail_custom.custom
122 struct arraytail
{ int i
; int arr
[]; };
123 // PATTERN-O0: @__const.test_int1_uninit.uninit = private unnamed_addr constant [1 x i32] {{\[}}i32 [[I32]]], align 4
124 // PATTERN-O0: @__const.test_int1_custom.custom = private unnamed_addr constant [1 x i32] [i32 858993459], align 4
125 // ZERO-O0: @__const.test_int1_custom.custom = private unnamed_addr constant [1 x i32] [i32 858993459], align 4
126 // PATTERN-O1-NOT: @__const.test_int1_uninit.uninit
127 // PATTERN-O1-NOT: @__const.test_int1_custom.custom
128 // ZERO-O1-NOT: @__const.test_int1_custom.custom
130 // PATTERN-O0: @__const.test_bool4_uninit.uninit = private unnamed_addr constant [4 x i8] c"\[[IC]]\[[IC]]\[[IC]]\[[IC]]", align 1
131 // PATTERN-O0: @__const.test_bool4_custom.custom = private unnamed_addr constant [4 x i8] c"\01\01\01\01", align 1
132 // ZERO-O0: @__const.test_bool4_custom.custom = private unnamed_addr constant [4 x i8] c"\01\01\01\01", align 1
133 // PATTERN-O1-NOT: @__const.test_bool4_uninit.uninit
134 // PATTERN-O1-NOT: @__const.test_bool4_custom.custom
135 // ZERO-O1-NOT: @__const.test_bool4_custom.custom
137 // 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
138 // PATTERN-O1-NOT: @__const.test_tailpad4_uninit.uninit
139 struct tailpad
{ short s
; char c
; };
140 // 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
141 // PATTERN-O1-NOT: @__const.test_atomicnotlockfree_uninit.uninit
142 struct notlockfree
{ long long a
[4]; };
143 // 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
144 // PATTERN-O1-NOT: @__const.test_atomicpadded_uninit.uninit
145 // 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
146 // PATTERN-O1-NOT: @__const.test_atomictailpad_uninit.uninit
147 // PATTERN-O0: @__const.test_complexfloat_uninit.uninit = private unnamed_addr constant { float, float } { float 0xFFFFFFFFE0000000, float 0xFFFFFFFFE0000000 }, align 4
148 // PATTERN-O1-NOT: @__const.test_complexfloat_uninit.uninit
149 // PATTERN-O0: @__const.test_complexdouble_uninit.uninit = private unnamed_addr constant { double, double } { double 0xFFFFFFFFFFFFFFFF, double 0xFFFFFFFFFFFFFFFF }, align 8
150 // PATTERN-O1-NOT: @__const.test_complexdouble_uninit.uninit
151 // PATTERN-O0: @__const.test_semivolatile_uninit.uninit = private unnamed_addr constant %struct.semivolatile { i32 [[I32]], i32 [[I32]] }, align 4
152 // PATTERN-O0: @__const.test_semivolatile_custom.custom = private unnamed_addr constant %struct.semivolatile { i32 1145324612, i32 1145324612 }, align 4
153 // PATTERN-O1-NOT: @__const.test_semivolatile_custom.custom
154 struct semivolatile
{ int i
; volatile int vi
; };
155 // PATTERN-O0: @__const.test_semivolatileinit_uninit.uninit = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
156 // PATTERN-O1-NOT: @__const.test_semivolatileinit_uninit.uninit
157 // PATTERN-O0: @__const.test_semivolatileinit_braces.braces = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
158 // PATTERN-O1-NOT: @__const.test_semivolatileinit_braces.braces
159 // PATTERN-O0: @__const.test_semivolatileinit_custom.custom = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
160 // PATTERN-O1-NOT: @__const.test_semivolatileinit_custom.custom = private unnamed_addr constant %struct.semivolatileinit { i32 [[I32]], i32 [[I32]] }, align 4
161 // ZERO-O0: @__const.test_semivolatile_custom.custom = private unnamed_addr constant %struct.semivolatile { i32 1145324612, i32 1145324612 }, align 4
162 // ZERO-O1-NOT: @__const.test_semivolatile_custom.custom
163 struct semivolatileinit
{ int i
= 0x11111111; volatile int vi
= 0x11111111; };
164 // PATTERN-O0: @__const.test_base_uninit.uninit = private unnamed_addr constant %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
165 // PATTERN-O1-NOT: @__const.test_base_uninit.uninit
166 // PATTERN-O0: @__const.test_base_braces.braces = private unnamed_addr constant %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) }, align
167 // PATTERN-O1-NOT: @__const.test_base_braces.braces
168 struct base
{ virtual ~base(); };
169 // PATTERN-O0: @__const.test_derived_uninit.uninit = private unnamed_addr constant %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } }, align
170 // PATTERN-O1-NOT: @__const.test_derived_uninit.uninit
171 // PATTERN-O0: @__const.test_derived_braces.braces = private unnamed_addr constant %struct.derived { %struct.base { ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr) } }, align
172 // PATTERN-O1-NOT: @__const.test_derived_braces.braces
173 struct derived
: public base
{};
174 // 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
175 // PATTERN-O1-NOT: @__const.test_virtualderived_uninit.uninit
176 // 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
177 // PATTERN-O1-NOT: @__const.test_virtualderived_braces.braces
178 struct virtualderived
: public virtual base
, public virtual derived
{};
179 // PATTERN-O0: @__const.test_matching_uninit.uninit = private unnamed_addr constant %union.matching { i32 [[I32]] }, align 4
180 // PATTERN-O1-NOT: @__const.test_matching_uninit.uninit
181 // PATTERN-O0: @__const.test_matching_custom.custom = private unnamed_addr constant { float } { float 6.145500e+04 }, align 4
182 // PATTERN-O1-NOT: @__const.test_matching_custom.custom
183 // ZERO-O0: @__const.test_matching_custom.custom = private unnamed_addr constant { float } { float 6.145500e+04 }, align 4
184 // ZERO-O1-NOT: @__const.test_matching_custom.custom
185 union matching
{ int i
; float f
; };
186 // PATTERN-O0: @__const.test_matchingreverse_uninit.uninit = private unnamed_addr constant %union.matchingreverse { float 0xFFFFFFFFE0000000 }, align 4
187 // PATTERN-O1-NOT: @__const.test_matchingreverse_uninit.uninit
188 // PATTERN-O0: @__const.test_matchingreverse_custom.custom = private unnamed_addr constant { i32 } { i32 61455 }, align 4
189 // PATTERN-O1-NOT: @__const.test_matchingreverse_custom.custom
190 // ZERO-O0: @__const.test_matchingreverse_custom.custom = private unnamed_addr constant { i32 } { i32 61455 }, align 4
191 // ZERO-O1-NOT: @__const.test_matchingreverse_custom.custom
192 union matchingreverse
{ float f
; int i
; };
193 // PATTERN-O0: @__const.test_unmatched_uninit.uninit = private unnamed_addr constant %union.unmatched { i32 [[I32]] }, align 4
194 // PATTERN-O1-NOT: @__const.test_unmatched_uninit.uninit
195 // PATTERN-O0: @__const.test_unmatched_custom.custom = private unnamed_addr constant %union.unmatched { i32 1001242351 }, align 4
196 // PATTERN-O1-NOT: @__const.test_unmatched_custom.custom
197 // ZERO-O0: @__const.test_unmatched_custom.custom = private unnamed_addr constant %union.unmatched { i32 1001242351 }, align 4
198 // ZERO-O1-NOT: @__const.test_unmatched_custom.custom
199 union unmatched
{ char c
; int i
; };
200 // PATTERN-O0: @__const.test_unmatchedreverse_uninit.uninit = private unnamed_addr constant %union.unmatchedreverse { i32 [[I32]] }, align 4
201 // PATTERN-O1-NOT: @__const.test_unmatchedreverse_uninit.uninit
202 // 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
203 // PATTERN-O1-NOT: @__const.test_unmatchedreverse_custom.custom
204 // ZERO-O0: @__const.test_unmatchedreverse_custom.custom = private unnamed_addr constant { i8, [3 x i8] } { i8 42, [3 x i8] zeroinitializer }, align 4
205 // ZERO-O1-NOT: @__const.test_unmatchedreverse_custom.custom
206 union unmatchedreverse
{ int i
; char c
; };
207 // PATTERN-O0: @__const.test_unmatchedfp_uninit.uninit = private unnamed_addr constant %union.unmatchedfp { double 0xFFFFFFFFFFFFFFFF }, align
208 // PATTERN-O1-NOT: @__const.test_unmatchedfp_uninit.uninit
209 // PATTERN-O0: @__const.test_unmatchedfp_custom.custom = private unnamed_addr constant %union.unmatchedfp { double 0x400921FB54442D18 }, align
210 // PATTERN-O1-NOT: @__const.test_unmatchedfp_custom.custom
211 // ZERO-O0: @__const.test_unmatchedfp_custom.custom = private unnamed_addr constant %union.unmatchedfp { double 0x400921FB54442D18 }, align 8
212 // ZERO-O1-NOT: @__const.test_unmatchedfp_custom.custom
213 union unmatchedfp
{ float f
; double d
; };
215 enum smallenum
{ VALUE
};
219 TEST_UNINIT(char, char);
220 // CHECK-LABEL: @test_char_uninit()
221 // CHECK: %uninit = alloca i8, align
222 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
223 // PATTERN-LABEL: @test_char_uninit()
224 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
225 // ZERO-LABEL: @test_char_uninit()
226 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT:!.+]]
228 TEST_BRACES(char, char);
229 // CHECK-LABEL: @test_char_braces()
230 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
231 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
232 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
234 TEST_UNINIT(uchar
, unsigned char);
235 // CHECK-LABEL: @test_uchar_uninit()
236 // CHECK: %uninit = alloca i8, align
237 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
238 // PATTERN-LABEL: @test_uchar_uninit()
239 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
240 // ZERO-LABEL: @test_uchar_uninit()
241 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
243 TEST_BRACES(uchar
, unsigned char);
244 // CHECK-LABEL: @test_uchar_braces()
245 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
246 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
247 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
249 TEST_UNINIT(schar
, signed char);
250 // CHECK-LABEL: @test_schar_uninit()
251 // CHECK: %uninit = alloca i8, align
252 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
253 // PATTERN-LABEL: @test_schar_uninit()
254 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
255 // ZERO-LABEL: @test_schar_uninit()
256 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
258 TEST_BRACES(schar
, signed char);
259 // CHECK-LABEL: @test_schar_braces()
260 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
261 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
262 // CHECK-NOT: !annotation
263 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
265 TEST_UNINIT(wchar_t, wchar_t);
266 // CHECK-LABEL: @test_wchar_t_uninit()
267 // CHECK: %uninit = alloca i32, align
268 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
269 // PATTERN-LABEL: @test_wchar_t_uninit()
270 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
271 // ZERO-LABEL: @test_wchar_t_uninit()
272 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
274 TEST_BRACES(wchar_t, wchar_t);
275 // CHECK-LABEL: @test_wchar_t_braces()
276 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
277 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
278 // CHECK-NOT: !annotation
279 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
281 TEST_UNINIT(short, short);
282 // CHECK-LABEL: @test_short_uninit()
283 // CHECK: %uninit = alloca i16, align
284 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
285 // PATTERN-LABEL: @test_short_uninit()
286 // PATTERN: store i16 [[I16]], ptr %uninit, align 2, !annotation [[AUTO_INIT]]
287 // ZERO-LABEL: @test_short_uninit()
288 // ZERO: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
290 TEST_BRACES(short, short);
291 // CHECK-LABEL: @test_short_braces()
292 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]]
293 // CHECK-NEXT: store i16 0, ptr %braces, align [[ALIGN]]
294 // CHECK-NOT: !annotation
295 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
297 TEST_UNINIT(ushort
, unsigned short);
298 // CHECK-LABEL: @test_ushort_uninit()
299 // CHECK: %uninit = alloca i16, align
300 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
301 // PATTERN-LABEL: @test_ushort_uninit()
302 // PATTERN: store i16 [[I16]], ptr %uninit, align 2, !annotation [[AUTO_INIT]]
303 // ZERO-LABEL: @test_ushort_uninit()
304 // ZERO: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
306 TEST_BRACES(ushort
, unsigned short);
307 // CHECK-LABEL: @test_ushort_braces()
308 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]]
309 // CHECK-NEXT: store i16 0, ptr %braces, align [[ALIGN]]
310 //CHECK-NOT: !annotation
311 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
313 TEST_UNINIT(int, int);
314 // CHECK-LABEL: @test_int_uninit()
315 // CHECK: %uninit = alloca i32, align
316 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
317 // PATTERN-LABEL: @test_int_uninit()
318 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
319 // ZERO-LABEL: @test_int_uninit()
320 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
322 TEST_BRACES(int, int);
323 // CHECK-LABEL: @test_int_braces()
324 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
325 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
326 // CHECK-NOT: !annotation
327 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
329 TEST_UNINIT(unsigned, unsigned);
330 // CHECK-LABEL: @test_unsigned_uninit()
331 // CHECK: %uninit = alloca i32, align
332 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
333 // PATTERN-LABEL: @test_unsigned_uninit()
334 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
335 // ZERO-LABEL: @test_unsigned_uninit()
336 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
338 TEST_BRACES(unsigned, unsigned);
339 // CHECK-LABEL: @test_unsigned_braces()
340 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
341 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
342 // CHECK-NOT: !annotation
343 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
345 TEST_UNINIT(long, long);
346 // CHECK-LABEL: @test_long_uninit()
347 // CHECK: %uninit = alloca i64, align
348 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
349 // PATTERN-LABEL: @test_long_uninit()
350 // PATTERN: store [[ILONGT]] [[ILONG]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
351 // ZERO-LABEL: @test_long_uninit()
352 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
354 TEST_BRACES(long, long);
355 // CHECK-LABEL: @test_long_braces()
356 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
357 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
358 // CHECK-NOT: !annotation
359 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
361 TEST_UNINIT(ulong
, unsigned long);
362 // CHECK-LABEL: @test_ulong_uninit()
363 // CHECK: %uninit = alloca i64, align
364 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
365 // PATTERN-LABEL: @test_ulong_uninit()
366 // PATTERN: store [[ILONGT]] [[ILONG]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
367 // ZERO-LABEL: @test_ulong_uninit()
368 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
370 TEST_BRACES(ulong
, unsigned long);
371 // CHECK-LABEL: @test_ulong_braces()
372 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
373 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
374 // CHECK-NOT: !annotation
375 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
377 TEST_UNINIT(longlong
, long long);
378 // CHECK-LABEL: @test_longlong_uninit()
379 // CHECK: %uninit = alloca i64, align
380 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
381 // PATTERN-LABEL: @test_longlong_uninit()
382 // PATTERN: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
383 // ZERO-LABEL: @test_longlong_uninit()
384 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
386 TEST_BRACES(longlong
, long long);
387 // CHECK-LABEL: @test_longlong_braces()
388 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
389 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
390 // CHECK-NOT: !annotation
391 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
393 TEST_UNINIT(ulonglong
, unsigned long long);
394 // CHECK-LABEL: @test_ulonglong_uninit()
395 // CHECK: %uninit = alloca i64, align
396 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
397 // PATTERN-LABEL: @test_ulonglong_uninit()
398 // PATTERN: store i64 [[I64]], ptr %uninit, align 8, !annotation [[AUTO_INIT]]
399 // ZERO-LABEL: @test_ulonglong_uninit()
400 // ZERO: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
402 TEST_BRACES(ulonglong
, unsigned long long);
403 // CHECK-LABEL: @test_ulonglong_braces()
404 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]]
405 // CHECK-NEXT: store i64 0, ptr %braces, align [[ALIGN]]
406 // CHECK-NOT: !annotation
407 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
409 TEST_UNINIT(int128
, __int128
);
410 // CHECK-LABEL: @test_int128_uninit()
411 // CHECK: %uninit = alloca i128, align
412 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
413 // PATTERN-LABEL: @test_int128_uninit()
414 // PATTERN: store [[I128T]] [[I128]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
415 // ZERO-LABEL: @test_int128_uninit()
416 // ZERO: store i128 0, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
418 TEST_BRACES(int128
, __int128
);
419 // CHECK-LABEL: @test_int128_braces()
420 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]]
421 // CHECK-NEXT: store i128 0, ptr %braces, align [[ALIGN]]
422 // CHECK-NOT: !annotation
423 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
425 TEST_UNINIT(uint128
, unsigned __int128
);
426 // CHECK-LABEL: @test_uint128_uninit()
427 // CHECK: %uninit = alloca i128, align
428 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
429 // PATTERN-LABEL: @test_uint128_uninit()
430 // PATTERN: store [[I128T]] [[I128]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
431 // ZERO-LABEL: @test_uint128_uninit()
432 // ZERO: store i128 0, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
434 TEST_BRACES(uint128
, unsigned __int128
);
435 // CHECK-LABEL: @test_uint128_braces()
436 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]]
437 // CHECK-NEXT: store i128 0, ptr %braces, align [[ALIGN]]
438 // CHECK-NOT: !annotation
439 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
441 TEST_UNINIT(fp16
, __fp16
);
442 // CHECK-LABEL: @test_fp16_uninit()
443 // CHECK: %uninit = alloca half, align
444 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
445 // PATTERN-LABEL: @test_fp16_uninit()
446 // PATTERN: store half 0xHFFFF, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
447 // ZERO-LABEL: @test_fp16_uninit()
448 // ZERO: store half 0xH0000, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
450 TEST_BRACES(fp16
, __fp16
);
451 // CHECK-LABEL: @test_fp16_braces()
452 // CHECK: %braces = alloca half, align [[ALIGN:[0-9]*]]
453 // CHECK-NEXT: store half 0xH0000, ptr %braces, align [[ALIGN]]
454 // CHECK-NOT: !annotation
455 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
457 TEST_UNINIT(float, float);
458 // CHECK-LABEL: @test_float_uninit()
459 // CHECK: %uninit = alloca float, align
460 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
461 // PATTERN-LABEL: @test_float_uninit()
462 // PATTERN: store float 0xFFFFFFFFE0000000, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
463 // ZERO-LABEL: @test_float_uninit()
464 // ZERO: store float 0.000000e+00, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
466 TEST_BRACES(float, float);
467 // CHECK-LABEL: @test_float_braces()
468 // CHECK: %braces = alloca float, align [[ALIGN:[0-9]*]]
469 // CHECK-NEXT: store float 0.000000e+00, ptr %braces, align [[ALIGN]]
470 // CHECK-NOT: !annotation
471 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
473 TEST_UNINIT(double, double);
474 // CHECK-LABEL: @test_double_uninit()
475 // CHECK: %uninit = alloca double, align
476 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
477 // PATTERN-LABEL: @test_double_uninit()
478 // PATTERN: store double 0xFFFFFFFFFFFFFFFF, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
479 // ZERO-LABEL: @test_double_uninit()
480 // ZERO: store double 0.000000e+00, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
482 TEST_BRACES(double, double);
483 // CHECK-LABEL: @test_double_braces()
484 // CHECK: %braces = alloca double, align [[ALIGN:[0-9]*]]
485 // CHECK-NEXT: store double 0.000000e+00, ptr %braces, align [[ALIGN]]
486 // CHECK-NOT: !annotation
487 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
489 TEST_UNINIT(longdouble
, long double);
490 // CHECK-LABEL: @test_longdouble_uninit()
491 // CHECK: %uninit = alloca x86_fp80, align
492 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
493 // PATTERN-LABEL: @test_longdouble_uninit()
494 // PATTERN: store x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
495 // ZERO-LABEL: @test_longdouble_uninit()
496 // ZERO: store x86_fp80 0xK00000000000000000000, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
498 TEST_BRACES(longdouble
, long double);
499 // CHECK-LABEL: @test_longdouble_braces()
500 // CHECK: %braces = alloca x86_fp80, align [[ALIGN:[0-9]*]]
501 // CHECK-NEXT: store x86_fp80 0xK00000000000000000000, ptr %braces, align [[ALIGN]]
502 // CHECK-NOT: !annotation
503 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
505 TEST_UNINIT(intptr
, int*);
506 // CHECK-LABEL: @test_intptr_uninit()
507 // CHECK: %uninit = alloca ptr, align
508 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
509 // PATTERN-LABEL: @test_intptr_uninit()
510 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
511 // ZERO-LABEL: @test_intptr_uninit()
512 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
514 TEST_BRACES(intptr
, int*);
515 // CHECK-LABEL: @test_intptr_braces()
516 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
517 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
518 // CHECK-NOT: !annotation
519 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
521 TEST_UNINIT(intptrptr
, int**);
522 // CHECK-LABEL: @test_intptrptr_uninit()
523 // CHECK: %uninit = alloca ptr, align
524 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
525 // PATTERN-LABEL: @test_intptrptr_uninit()
526 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
527 // ZERO-LABEL: @test_intptrptr_uninit()
528 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
530 TEST_BRACES(intptrptr
, int**);
531 // CHECK-LABEL: @test_intptrptr_braces()
532 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
533 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
534 // CHECK-NOT: !annotation
535 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
537 TEST_UNINIT(function
, void(*)());
538 // CHECK-LABEL: @test_function_uninit()
539 // CHECK: %uninit = alloca ptr, align
540 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
541 // PATTERN-LABEL: @test_function_uninit()
542 // PATTERN: store ptr inttoptr ([[IPTRT]] [[IPTR]] to ptr), ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
543 // ZERO-LABEL: @test_function_uninit()
544 // ZERO: store ptr null, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
546 TEST_BRACES(function
, void(*)());
547 // CHECK-LABEL: @test_function_braces()
548 // CHECK: %braces = alloca ptr, align [[ALIGN:[0-9]*]]
549 // CHECK-NEXT: store ptr null, ptr %braces, align [[ALIGN]]
550 // CHECK-NOT: !annotation
551 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
553 TEST_UNINIT(bool, bool);
554 // CHECK-LABEL: @test_bool_uninit()
555 // CHECK: %uninit = alloca i8, align
556 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
557 // PATTERN-LABEL: @test_bool_uninit()
558 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
559 // ZERO-LABEL: @test_bool_uninit()
560 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
562 TEST_BRACES(bool, bool);
563 // CHECK-LABEL: @test_bool_braces()
564 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]]
565 // CHECK-NEXT: store i8 0, ptr %braces, align [[ALIGN]]
566 // CHECK-NOT: !annotation
567 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
569 TEST_UNINIT(empty
, empty
);
570 // CHECK-LABEL: @test_empty_uninit()
571 // CHECK: %uninit = alloca %struct.empty, align
572 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
573 // PATTERN-LABEL: @test_empty_uninit()
574 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_empty_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
575 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
576 // ZERO-LABEL: @test_empty_uninit()
577 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
578 // ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
580 TEST_BRACES(empty
, empty
);
581 // CHECK-LABEL: @test_empty_braces()
582 // CHECK: %braces = alloca %struct.empty, align
583 // CHECK-NEXT: call void @llvm.memcpy
584 // CHECK-NOT: !annotation
585 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
587 TEST_UNINIT(small
, small
);
588 // CHECK-LABEL: @test_small_uninit()
589 // CHECK: %uninit = alloca %struct.small, align
590 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
591 // PATTERN-LABEL: @test_small_uninit()
592 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_small_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
593 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
594 // ZERO-LABEL: @test_small_uninit()
595 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
596 // ZERO-O1: store i8 0, {{.*}} align 1, !annotation [[AUTO_INIT]]
598 TEST_BRACES(small
, small
);
599 // CHECK-LABEL: @test_small_braces()
600 // CHECK: %braces = alloca %struct.small, align [[ALIGN:[0-9]*]]
601 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 1, i1 false)
602 // CHECK-NOT: !annotation
603 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
605 TEST_CUSTOM(small
, small
, { 42 });
606 // CHECK-LABEL: @test_small_custom()
607 // CHECK: %custom = alloca %struct.small, align
608 // CHECK-NEXT: call void @llvm.memcpy
609 // CHECK-NOT: !annotation
610 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
612 TEST_UNINIT(smallinit
, smallinit
);
613 // CHECK-LABEL: @test_smallinit_uninit()
614 // CHECK: %uninit = alloca %struct.smallinit, align
615 // CHECK-NEXT: call void @{{.*}}smallinit{{.*}}%uninit)
616 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
618 TEST_BRACES(smallinit
, smallinit
);
619 // CHECK-LABEL: @test_smallinit_braces()
620 // CHECK: %braces = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
621 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.smallinit, ptr %braces, i32 0, i32 0
622 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
623 // CHECK-NOT: !annotation
624 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
626 TEST_CUSTOM(smallinit
, smallinit
, { 100 });
627 // CHECK-LABEL: @test_smallinit_custom()
628 // CHECK: %custom = alloca %struct.smallinit, align [[ALIGN:[0-9]*]]
629 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.smallinit, ptr %custom, i32 0, i32 0
630 // CHECK-NEXT: store i8 100, ptr %[[C]], align [[ALIGN]]
631 // CHECK-NOT: !annotation
632 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
634 TEST_UNINIT(smallpartinit
, smallpartinit
);
635 // CHECK-LABEL: @test_smallpartinit_uninit()
636 // CHECK: %uninit = alloca %struct.smallpartinit, align
637 // CHECK-NEXT: call void @{{.*}}smallpartinit{{.*}}%uninit)
638 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
639 // PATTERN-LABEL: @test_smallpartinit_uninit()
640 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_smallpartinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
641 // PATTERN-O1: store i8 [[I8]], {{.*}} align 1, !annotation [[AUTO_INIT]]
642 // PATTERN-O1: store i8 42, {{.*}} align 1
643 // ZERO-LABEL: @test_smallpartinit_uninit()
644 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
645 // ZERO-O1: store i16 0, ptr %uninit, align 2, !annotation [[AUTO_INIT]]
647 TEST_BRACES(smallpartinit
, smallpartinit
);
648 // CHECK-LABEL: @test_smallpartinit_braces()
649 // CHECK: %braces = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
650 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.smallpartinit, ptr %braces, i32 0, i32 0
651 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
652 // CHECK-NOT: !annotation
653 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds nuw %struct.smallpartinit, ptr %braces, i32 0, i32 1
654 // CHECK-NEXT: store i8 0, ptr %[[D]], align [[ALIGN]]
655 // CHECK-NOT: !annotation
656 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
658 TEST_CUSTOM(smallpartinit
, smallpartinit
, { 100, 42 });
659 // CHECK-LABEL: @test_smallpartinit_custom()
660 // CHECK: %custom = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]]
661 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.smallpartinit, ptr %custom, i32 0, i32 0
662 // CHECK-NEXT: store i8 100, ptr %[[C]], align [[ALIGN]]
663 // CHECK-NOT: !annotation
664 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds nuw %struct.smallpartinit, ptr %custom, i32 0, i32 1
665 // CHECK-NEXT: store i8 42, ptr %[[D]], align [[ALIGN]]
666 // CHECK-NOT: !annotation
667 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
669 TEST_UNINIT(nullinit
, nullinit
);
670 // CHECK-LABEL: @test_nullinit_uninit()
671 // CHECK: %uninit = alloca %struct.nullinit, align
672 // CHECK-NEXT: call void @{{.*}}nullinit{{.*}}%uninit)
673 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
675 TEST_BRACES(nullinit
, nullinit
);
676 // CHECK-LABEL: @test_nullinit_braces()
677 // CHECK: %braces = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
678 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds nuw %struct.nullinit, ptr %braces, i32 0, i32 0
679 // CHECK-NEXT: store ptr null, ptr %[[N]], align [[ALIGN]]
680 // CHECK-NOT: !annotation
681 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
683 TEST_CUSTOM(nullinit
, nullinit
, { (char*)"derp" });
684 // CHECK-LABEL: @test_nullinit_custom()
685 // CHECK: %custom = alloca %struct.nullinit, align [[ALIGN:[0-9]*]]
686 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds nuw %struct.nullinit, ptr %custom, i32 0, i32 0
687 // CHECK-NEXT: store ptr {{.*}}, ptr %[[N]], align [[ALIGN]]
688 // CHECK-NOT: !annotation
689 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
691 TEST_UNINIT(padded
, padded
);
692 // CHECK-LABEL: @test_padded_uninit()
693 // CHECK: %uninit = alloca %struct.padded, align
694 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
695 // PATTERN-LABEL: @test_padded_uninit()
696 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_padded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
697 // PATTERN-O1: store i64 [[I64]], ptr %uninit, align 8
698 // PATTERN-O1-NOT: !annotation
699 // ZERO-LABEL: @test_padded_uninit()
700 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
701 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
703 TEST_BRACES(padded
, padded
);
704 // CHECK-LABEL: @test_padded_braces()
705 // CHECK: %braces = alloca %struct.padded, align [[ALIGN:[0-9]*]]
706 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
707 // CHECK-NOT: !annotation
708 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
710 TEST_CUSTOM(padded
, padded
, { 42, 13371337 });
711 // CHECK-LABEL: @test_padded_custom()
712 // CHECK: %custom = alloca %struct.padded, align
713 // CHECK-NEXT: call void @llvm.memcpy
714 // CHECK-NOT: !annotation
715 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
717 TEST_UNINIT(paddednullinit
, paddednullinit
);
718 // CHECK-LABEL: @test_paddednullinit_uninit()
719 // CHECK: %uninit = alloca %struct.paddednullinit, align
720 // CHECK-NEXT: call void @{{.*}}paddednullinit{{.*}}%uninit)
721 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
722 // PATTERN-LABEL: @test_paddednullinit_uninit()
723 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednullinit_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
724 // PATTERN-O1: store i64 [[I64]], ptr %uninit, align 8
725 // PATTERN-O1-NOT: !annotation
726 // ZERO-LABEL: @test_paddednullinit_uninit()
727 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.*}}, !annotation [[AUTO_INIT]]
728 // ZERO-O1: store i64 0, ptr %uninit, align 8
729 // FIXME: !annotation dropped by optimizations
730 // ZERO-O1-NOT: !annotation
734 TEST_BRACES(paddednullinit
, paddednullinit
);
735 // CHECK-LABEL: @test_paddednullinit_braces()
736 // CHECK: %braces = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
737 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.paddednullinit, ptr %braces, i32 0, i32 0
738 // CHECK-NEXT: store i8 0, ptr %[[C]], align [[ALIGN]]
739 // CHECK-NOT: !annotation
740 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw %struct.paddednullinit, ptr %braces, i32 0, i32 1
741 // CHECK-NEXT: store i32 0, ptr %[[I]], align [[ALIGN]]
742 // CHECK-NOT: !annotation
743 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
745 TEST_CUSTOM(paddednullinit
, paddednullinit
, { 42, 13371337 });
746 // CHECK-LABEL: @test_paddednullinit_custom()
747 // CHECK: %custom = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]]
748 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds nuw %struct.paddednullinit, ptr %custom, i32 0, i32 0
749 // CHECK-NEXT: store i8 42, ptr %[[C]], align [[ALIGN]]
750 // CHECK-NOT: !annotation
751 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw %struct.paddednullinit, ptr %custom, i32 0, i32 1
752 // CHECK-NEXT: store i32 13371337, ptr %[[I]], align [[ALIGN]]
753 // CHECK-NOT: !annotation
754 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
756 TEST_UNINIT(paddedpacked
, paddedpacked
);
757 // CHECK-LABEL: @test_paddedpacked_uninit()
758 // CHECK: %uninit = alloca %struct.paddedpacked, align
759 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
760 // PATTERN-LABEL: @test_paddedpacked_uninit()
761 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpacked_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
762 // PATTERN-O1: store i8 [[I8]], ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
763 // PATTERN-O1: %[[I:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 1
764 // PATTERN-O1: store i32 [[I32]], ptr %[[I]], align {{.+}}, !annotation [[AUTO_INIT]]
765 // ZERO-LABEL: @test_paddedpacked_uninit()
766 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
768 TEST_BRACES(paddedpacked
, paddedpacked
);
769 // CHECK-LABEL: @test_paddedpacked_braces()
770 // CHECK: %braces = alloca %struct.paddedpacked, align [[ALIGN:[0-9]*]]
771 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 5, i1 false)
772 // CHECK-NOT: !annotation
773 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
775 TEST_CUSTOM(paddedpacked
, paddedpacked
, { 42, 13371337 });
776 // CHECK-LABEL: @test_paddedpacked_custom()
777 // CHECK: %custom = alloca %struct.paddedpacked, align
778 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpacked_custom.custom
779 // CHECK-NOT: !annotation
780 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
782 TEST_UNINIT(paddedpackedarray
, paddedpackedarray
);
783 // CHECK-LABEL: @test_paddedpackedarray_uninit()
784 // CHECK: %uninit = alloca %struct.paddedpackedarray, align
785 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
786 // PATTERN-LABEL: @test_paddedpackedarray_uninit()
787 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackedarray_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
788 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}i8 [[I8]], i64 10
789 // FIXME: !annotation dropped by optimizations
790 // PATTERN-O1-NOT: !annotation
791 // ZERO-LABEL: @test_paddedpackedarray_uninit()
792 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
794 TEST_BRACES(paddedpackedarray
, paddedpackedarray
);
795 // CHECK-LABEL: @test_paddedpackedarray_braces()
796 // CHECK: %braces = alloca %struct.paddedpackedarray, align [[ALIGN:[0-9]*]]
797 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
798 // CHECK-NOT: !annotation
799 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
801 TEST_CUSTOM(paddedpackedarray
, paddedpackedarray
, { {{ 42, 13371337 }, { 43, 13371338 }} });
802 // CHECK-LABEL: @test_paddedpackedarray_custom()
803 // CHECK: %custom = alloca %struct.paddedpackedarray, align
804 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackedarray_custom.custom
805 // CHECK-NOT: !annotation
806 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
808 TEST_UNINIT(unpackedinpacked
, unpackedinpacked
);
809 // PATTERN-LABEL: @test_unpackedinpacked_uninit()
810 // PATTERN-O0: call void @llvm.memcpy{{.*}} 9, i1 false), !annotation [[AUTO_INIT]]
812 TEST_UNINIT(paddednested
, paddednested
);
813 // CHECK-LABEL: @test_paddednested_uninit()
814 // CHECK: %uninit = alloca %struct.paddednested, align
815 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
816 // PATTERN-LABEL: @test_paddednested_uninit()
817 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
818 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16{{.+}})
819 // FIXME: !annotation dropped by optimizations
820 // PATTERN-O1-NOT: !annotation
821 // ZERO-LABEL: @test_paddednested_uninit()
822 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
824 TEST_BRACES(paddednested
, paddednested
);
825 // CHECK-LABEL: @test_paddednested_braces()
826 // CHECK: %braces = alloca %struct.paddednested, align [[ALIGN:[0-9]*]]
827 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
828 // CHECK-NOT: !annotation
829 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
831 TEST_CUSTOM(paddednested
, paddednested
, { { 42, 13371337 }, { 43, 13371338 } });
832 // CHECK-LABEL: @test_paddednested_custom()
833 // CHECK: %custom = alloca %struct.paddednested, align
834 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddednested_custom.custom
835 // CHECK-NOT: !annotation
836 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
838 TEST_UNINIT(paddedpackednested
, paddedpackednested
);
839 // CHECK-LABEL: @test_paddedpackednested_uninit()
840 // CHECK: %uninit = alloca %struct.paddedpackednested, align
841 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
842 // PATTERN-LABEL: @test_paddedpackednested_uninit()
843 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_paddedpackednested_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
844 // PATTERN-O1: call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(10) %uninit, i8 [[I8]], i64 10, i1 false)
845 // FIXME: !annotation dropped by optimizations
846 // PATTERN-O1-NOT: !annotation
847 // ZERO-LABEL: @test_paddedpackednested_uninit()
848 // ZERO: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
850 TEST_BRACES(paddedpackednested
, paddedpackednested
);
851 // CHECK-LABEL: @test_paddedpackednested_braces()
852 // CHECK: %braces = alloca %struct.paddedpackednested, align [[ALIGN:[0-9]*]]
853 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 10, i1 false)
854 // CHECK-NOT: !annotation
855 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
857 TEST_CUSTOM(paddedpackednested
, paddedpackednested
, { { 42, 13371337 }, { 43, 13371338 } });
858 // CHECK-LABEL: @test_paddedpackednested_custom()
859 // CHECK: %custom = alloca %struct.paddedpackednested, align
860 // CHECK-NEXT: call void @llvm.memcpy{{.*}}({{.*}}@__const.test_paddedpackednested_custom.custom
861 // CHECK-NOT: !annotation
862 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
864 TEST_UNINIT(bitfield
, bitfield
);
865 // CHECK-LABEL: @test_bitfield_uninit()
866 // CHECK: %uninit = alloca %struct.bitfield, align
867 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
868 // PATTERN-LABEL: @test_bitfield_uninit()
869 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfield_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
870 // PATTERN-O1: store i32 [[I32]], ptr %uninit, align 4
871 // FIXME: !annotation dropped by optimizations
872 // PATTERN-O1-NOT: !annotation
873 // ZERO-LABEL: @test_bitfield_uninit()
874 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0{{.+}}), !annotation [[AUTO_INIT]]
875 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
877 TEST_BRACES(bitfield
, bitfield
);
878 // CHECK-LABEL: @test_bitfield_braces()
879 // CHECK: %braces = alloca %struct.bitfield, align
880 // CHECK-NEXT: call void @llvm.memcpy
881 // CHECK-NOT: !annotation
882 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
884 TEST_CUSTOM(bitfield
, bitfield
, { 4, 1 });
885 // CHECK-LABEL: @test_bitfield_custom()
886 // CHECK: %custom = alloca %struct.bitfield, align
887 // CHECK-NEXT: call void @llvm.memcpy
888 // CHECK-NOT: !annotation
889 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
891 TEST_UNINIT(bitfieldaligned
, bitfieldaligned
);
892 // CHECK-LABEL: @test_bitfieldaligned_uninit()
893 // CHECK: %uninit = alloca %struct.bitfieldaligned, align
894 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
895 // PATTERN-LABEL: @test_bitfieldaligned_uninit()
896 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bitfieldaligned_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
897 // PATTERN-O1: store i64 [[IPTR]], ptr %uninit, align 8
898 // FIXME: !annotation dropped by optimizations
899 // PATTERN-O1-NOT: !annotation
900 // ZERO-LABEL: @test_bitfieldaligned_uninit()
901 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
902 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
904 TEST_BRACES(bitfieldaligned
, bitfieldaligned
);
905 // CHECK-LABEL: @test_bitfieldaligned_braces()
906 // CHECK: %braces = alloca %struct.bitfieldaligned, align
907 // CHECK-NEXT: call void @llvm.memcpy
908 // CHECK-NOT: !annotation
909 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
911 TEST_CUSTOM(bitfieldaligned
, bitfieldaligned
, { 4, 1 });
912 // CHECK-LABEL: @test_bitfieldaligned_custom()
913 // CHECK: %custom = alloca %struct.bitfieldaligned, align
914 // CHECK-NEXT: call void @llvm.memcpy
915 // CHECK-NOT: !annotation
916 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
918 TEST_UNINIT(big
, big
);
919 // CHECK-LABEL: @test_big_uninit()
920 // CHECK: %uninit = alloca %struct.big, align
921 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
922 // PATTERN-LABEL: @test_big_uninit()
923 // PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
924 // ZERO-LABEL: @test_big_uninit()
925 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
927 TEST_BRACES(big
, big
);
928 // CHECK-LABEL: @test_big_braces()
929 // CHECK: %braces = alloca %struct.big, align [[ALIGN:[0-9]*]]
930 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 104, i1 false)
931 // CHECK-NOT: !annotation
932 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
934 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 });
935 // CHECK-LABEL: @test_big_custom()
936 // CHECK: %custom = alloca %struct.big, align [[ALIGN:[0-9]*]]
937 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 -86, i64 104, i1 false)
938 // CHECK-NOT: !annotation
939 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
941 TEST_UNINIT(arraytail
, arraytail
);
942 // CHECK-LABEL: @test_arraytail_uninit()
943 // CHECK: %uninit = alloca %struct.arraytail, align
944 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
945 // PATTERN-LABEL: @test_arraytail_uninit()
946 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_arraytail_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
947 // PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
948 // ZERO-LABEL: @test_arraytail_uninit()
949 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
950 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
952 TEST_BRACES(arraytail
, arraytail
);
953 // CHECK-LABEL: @test_arraytail_braces()
954 // CHECK: %braces = alloca %struct.arraytail, align [[ALIGN:[0-9]*]]
955 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
956 // CHECK-NOT: !annotation
957 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
959 TEST_CUSTOM(arraytail
, arraytail
, { 0xdead });
960 // CHECK-LABEL: @test_arraytail_custom()
961 // CHECK: %custom = alloca %struct.arraytail, align
962 // CHECK-NEXT: call void @llvm.memcpy
963 // CHECK-NOT: !annotation
964 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
966 TEST_UNINIT(int0
, int[0]);
967 // CHECK-LABEL: @test_int0_uninit()
968 // CHECK: %uninit = alloca [0 x i32], align
969 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
970 // PATTERN-LABEL: @test_int0_uninit()
971 // PATTERN: %uninit = alloca [0 x i32], align
972 // PATTERN-O0-NEXT: call void @{{.*}}used{{.*}}%uninit)
973 // ZERO-LABEL: @test_int0_uninit()
974 // ZERO: %uninit = alloca [0 x i32], align
975 // ZERO-O0-NEXT: call void @{{.*}}used{{.*}}%uninit)
977 TEST_BRACES(int0
, int[0]);
978 // CHECK-LABEL: @test_int0_braces()
979 // CHECK: %braces = alloca [0 x i32], align [[ALIGN:[0-9]*]]
980 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
982 TEST_UNINIT(int1
, int[1]);
983 // CHECK-LABEL: @test_int1_uninit()
984 // CHECK: %uninit = alloca [1 x i32], align [[ALIGN:[0-9]*]]
985 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
986 // PATTERN-LABEL: @test_int1_uninit()
987 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_int1_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
988 // PATTERN-O1: store i32 [[I32]], {{.*}} align 4, !annotation [[AUTO_INIT]]
989 // ZERO-LABEL: @test_int1_uninit()
990 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
991 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
993 TEST_BRACES(int1
, int[1]);
994 // CHECK-LABEL: @test_int1_braces()
995 // CHECK: %braces = alloca [1 x i32], align [[ALIGN:[0-9]*]]
996 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
997 // CHECK-NOT: !annotation
998 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1000 TEST_CUSTOM(int1
, int[1], { 0x33333333 });
1001 // CHECK-LABEL: @test_int1_custom()
1002 // CHECK: %custom = alloca [1 x i32], align
1003 // CHECK-NEXT: call void @llvm.memcpy
1004 // CHECK-NOT: !annotation
1005 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1007 TEST_UNINIT(int64
, int[64]);
1008 // CHECK-LABEL: @test_int64_uninit()
1009 // CHECK: %uninit = alloca [64 x i32], align
1010 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1011 // PATTERN-LABEL: @test_int64_uninit()
1012 // PATTERN: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
1013 // ZERO-LABEL: @test_int64_uninit()
1014 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1016 TEST_BRACES(int64
, int[64]);
1017 // CHECK-LABEL: @test_int64_braces()
1018 // CHECK: %braces = alloca [64 x i32], align [[ALIGN:[0-9]*]]
1019 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 256, i1 false)
1020 // CHECK-NOT: !annotation
1021 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1023 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 });
1024 // CHECK-LABEL: @test_int64_custom()
1025 // CHECK: %custom = alloca [64 x i32], align [[ALIGN:[0-9]*]]
1026 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 17, i64 256, i1 false)
1027 // CHECK-NOT: !annotation
1028 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1030 TEST_UNINIT(bool4
, bool[4]);
1031 // CHECK-LABEL: @test_bool4_uninit()
1032 // CHECK: %uninit = alloca [4 x i8], align
1033 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1034 // PATTERN-LABEL: @test_bool4_uninit()
1035 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_bool4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1036 // PATTERN-O1: store i32 [[I32]], ptr %uninit, align 4
1037 // FIXME: !annotation dropped by optimizations
1038 // PATTERN-O1-NOT: !annotation
1039 // ZERO-LABEL: @test_bool4_uninit()
1040 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1041 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1043 TEST_BRACES(bool4
, bool[4]);
1044 // CHECK-LABEL: @test_bool4_braces()
1045 // CHECK: %braces = alloca [4 x i8], align [[ALIGN:[0-9]*]]
1046 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1047 // CHECK-NOT: !annotation
1048 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1050 TEST_CUSTOM(bool4
, bool[4], { true, true, true, true });
1051 // CHECK-LABEL: @test_bool4_custom()
1052 // CHECK: %custom = alloca [4 x i8], align
1053 // CHECK-NEXT: call void @llvm.memcpy
1054 // CHECK-NOT: !annotation
1055 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1057 TEST_UNINIT(intptr4
, int*[4]);
1058 // CHECK-LABEL: @test_intptr4_uninit()
1059 // CHECK: %uninit = alloca [4 x ptr], align
1060 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1061 // PATTERN-O1-LABEL: @test_intptr4_uninit()
1062 // PATTERN-O1: call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(32) %{{.*}}, i8 -86, i64 32, i1 false)
1063 // FIXME: !annotation dropped by optimizations
1064 // PATTERN-O1-NOT: !annotation
1065 // ZERO-LABEL: @test_intptr4_uninit()
1066 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1068 TEST_BRACES(intptr4
, int*[4]);
1069 // CHECK-LABEL: @test_intptr4_braces()
1070 // CHECK: %braces = alloca [4 x ptr], align [[ALIGN:[0-9]*]]
1071 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 32, i1 false)
1072 // CHECK-NOT: !annotation
1073 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1075 TEST_CUSTOM(intptr4
, int *[4], = {(int *)0x22222222, (int *)0x22222222, (int *)0x22222222, (int *)0x22222222});
1076 // CHECK-LABEL: @test_intptr4_custom()
1077 // CHECK: %custom = alloca [4 x ptr], align
1078 // CHECK-NEXT: call void @llvm.memcpy
1079 // CHECK-NOT: !annotation
1080 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1082 TEST_UNINIT(tailpad4
, tailpad
[4]);
1083 // CHECK-LABEL: @test_tailpad4_uninit()
1084 // CHECK: %uninit = alloca [4 x %struct.tailpad], align
1085 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1086 // PATTERN-LABEL: @test_tailpad4_uninit()
1087 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_tailpad4_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1088 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 16{{.+}})
1089 // FIXME: !annotation dropped by optimizations
1090 // PATTERN-O1-NOT: !annotation
1091 // ZERO-LABEL: @test_tailpad4_uninit()
1092 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1094 TEST_BRACES(tailpad4
, tailpad
[4]);
1095 // CHECK-LABEL: @test_tailpad4_braces()
1096 // CHECK: %braces = alloca [4 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1097 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
1098 // CHECK-NOT: !annotation
1099 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1101 TEST_CUSTOM(tailpad4
, tailpad
[4], { {257, 1}, {257, 1}, {257, 1}, {257, 1} });
1102 // CHECK-LABEL: @test_tailpad4_custom()
1103 // CHECK: %custom = alloca [4 x %struct.tailpad], align
1104 // CHECK-NEXT: call void @llvm.memcpy
1105 // CHECK-NOT: !annotation
1106 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1108 TEST_UNINIT(tailpad9
, tailpad
[9]);
1109 // CHECK-LABEL: @test_tailpad9_uninit()
1110 // CHECK: %uninit = alloca [9 x %struct.tailpad], align
1111 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1112 // PATTERN-LABEL: @test_tailpad9_uninit()
1113 // PATTERN-O0: call void @llvm.memset{{.*}}, i8 [[I8]],{{.+}}), !annotation [[AUTO_INIT]]
1114 // ZERO-LABEL: @test_tailpad9_uninit()
1115 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1117 TEST_BRACES(tailpad9
, tailpad
[9]);
1118 // CHECK-LABEL: @test_tailpad9_braces()
1119 // CHECK: %braces = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1120 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 36, i1 false)
1121 // CHECK-NOT: !annotation
1122 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1124 TEST_CUSTOM(tailpad9
, tailpad
[9], { {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1} });
1125 // CHECK-LABEL: @test_tailpad9_custom()
1126 // CHECK: %custom = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]]
1127 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 1, i64 36, i1 false)
1128 // CHECK-NOT: !annotation
1129 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1131 TEST_UNINIT(atomicbool
, _Atomic(bool));
1132 // CHECK-LABEL: @test_atomicbool_uninit()
1133 // CHECK: %uninit = alloca i8, align
1134 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1135 // PATTERN-LABEL: @test_atomicbool_uninit()
1136 // PATTERN: store i8 [[I8]], ptr %uninit, align 1, !annotation [[AUTO_INIT]]
1137 // ZERO-LABEL: @test_atomicbool_uninit()
1138 // ZERO: store i8 0, ptr %uninit, align 1, !annotation [[AUTO_INIT]]
1140 TEST_UNINIT(atomicint
, _Atomic(int));
1141 // CHECK-LABEL: @test_atomicint_uninit()
1142 // CHECK: %uninit = alloca i32, align
1143 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1144 // PATTERN-LABEL: @test_atomicint_uninit()
1145 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1146 // ZERO-LABEL: @test_atomicint_uninit()
1147 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1149 TEST_UNINIT(atomicdouble
, _Atomic(double));
1150 // CHECK-LABEL: @test_atomicdouble_uninit()
1151 // CHECK: %uninit = alloca double, align
1152 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1153 // PATTERN-LABEL: @test_atomicdouble_uninit()
1154 // PATTERN: store double 0xFFFFFFFFFFFFFFFF, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1155 // ZERO-LABEL: @test_atomicdouble_uninit()
1156 // ZERO: store double 0.000000e+00, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1158 TEST_UNINIT(atomicnotlockfree
, _Atomic(notlockfree
));
1159 // CHECK-LABEL: @test_atomicnotlockfree_uninit()
1160 // CHECK: %uninit = alloca %struct.notlockfree, align
1161 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1162 // PATTERN-LABEL: @test_atomicnotlockfree_uninit()
1163 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicnotlockfree_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1164 // PATTERN-O1: call void @llvm.memset{{.*}}({{.*}}, i8 [[I8]], i64 32{{.*}}
1165 // FIXME: !annotation dropped by optimizations
1166 // PATTERN-O1-NOT: !annotation
1167 // ZERO-LABEL: @test_atomicnotlockfree_uninit()
1168 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1170 TEST_UNINIT(atomicpadded
, _Atomic(padded
));
1171 // CHECK-LABEL: @test_atomicpadded_uninit()
1172 // CHECK: %uninit = alloca %struct.padded, align
1173 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1174 // PATTERN-LABEL: @test_atomicpadded_uninit()
1175 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomicpadded_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1176 // PATTERN-O1: store i64 [[IPTR]], ptr %uninit, align 8
1177 // PATTERN-O1-NOT: !annotation
1178 // ZERO-LABEL: @test_atomicpadded_uninit()
1179 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1180 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1182 TEST_UNINIT(atomictailpad
, _Atomic(tailpad
));
1183 // CHECK-LABEL: @test_atomictailpad_uninit()
1184 // CHECK: %uninit = alloca %struct.tailpad, align
1185 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1186 // PATTERN-LABEL: @test_atomictailpad_uninit()
1187 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_atomictailpad_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1188 // ZERO-LABEL: @test_atomictailpad_uninit()
1189 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1190 // ZERO-O1: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1192 TEST_UNINIT(complexfloat
, _Complex
float);
1193 // CHECK-LABEL: @test_complexfloat_uninit()
1194 // CHECK: %uninit = alloca { float, float }, align
1195 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1196 // PATTERN-LABEL: @test_complexfloat_uninit()
1197 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexfloat_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1198 // PATTERN-O1: store float 0xFFFFFFFFE0000000, ptr %uninit, align {{.+}}, !annotation [[AUTO_INIT]]
1199 // PATTERN-O1: %[[F2:[^ ]*]] = getelementptr inbounds {{.*}}%uninit, i64 4
1200 // PATTERN-O1: store float 0xFFFFFFFFE0000000, ptr %[[F2]], align {{.+}}, !annotation [[AUTO_INIT]]
1202 // ZERO-LABEL: @test_complexfloat_uninit()
1203 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1204 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1206 TEST_BRACES(complexfloat
, _Complex
float);
1207 // CHECK-LABEL: @test_complexfloat_braces()
1208 // CHECK: %braces = alloca { float, float }, align [[ALIGN:[0-9]*]]
1209 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds nuw { float, float }, ptr %braces, i32 0, i32 0
1210 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw { float, float }, ptr %braces, i32 0, i32 1
1211 // CHECK-NEXT: store float 0.000000e+00, ptr %[[R]], align [[ALIGN]]
1212 // CHECK-NOT: !annotation
1213 // CHECK-NEXT: store float 0.000000e+00, ptr %[[I]], align [[ALIGN]]
1214 // CHECK-NOT: !annotation
1215 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1217 TEST_CUSTOM(complexfloat
, _Complex
float, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
1218 // CHECK-LABEL: @test_complexfloat_custom()
1219 // CHECK: %custom = alloca { float, float }, align [[ALIGN:[0-9]*]]
1220 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds nuw { float, float }, ptr %custom, i32 0, i32 0
1221 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw { float, float }, ptr %custom, i32 0, i32 1
1222 // CHECK-NEXT: store float 0x400921FB60000000, ptr %[[R]], align [[ALIGN]]
1223 // CHECK-NOT: !annotation
1224 // CHECK-NEXT: store float 0x400921FB60000000, ptr %[[I]], align [[ALIGN]]
1225 // CHECK-NOT: !annotation
1226 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1228 TEST_UNINIT(complexdouble
, _Complex
double);
1229 // CHECK-LABEL: @test_complexdouble_uninit()
1230 // CHECK: %uninit = alloca { double, double }, align
1231 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1232 // PATTERN-LABEL: @test_complexdouble_uninit()
1233 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_complexdouble_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1234 // ZERO-LABEL: @test_complexdouble_uninit()
1235 // ZERO: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1237 TEST_BRACES(complexdouble
, _Complex
double);
1238 // CHECK-LABEL: @test_complexdouble_braces()
1239 // CHECK: %braces = alloca { double, double }, align [[ALIGN:[0-9]*]]
1240 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds nuw { double, double }, ptr %braces, i32 0, i32 0
1241 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw { double, double }, ptr %braces, i32 0, i32 1
1242 // CHECK-NEXT: store double 0.000000e+00, ptr %[[R]], align [[ALIGN]]
1243 // CHECK-NOT: !annotation
1244 // CHECK-NEXT: store double 0.000000e+00, ptr %[[I]], align [[ALIGN]]
1245 // CHECK-NOT: !annotation
1246 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1248 TEST_CUSTOM(complexdouble
, _Complex
double, { 3.1415926535897932384626433, 3.1415926535897932384626433 });
1249 // CHECK-LABEL: @test_complexdouble_custom()
1250 // CHECK: %custom = alloca { double, double }, align [[ALIGN:[0-9]*]]
1251 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds nuw { double, double }, ptr %custom, i32 0, i32 0
1252 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw { double, double }, ptr %custom, i32 0, i32 1
1253 // CHECK-NEXT: store double 0x400921FB54442D18, ptr %[[R]], align [[ALIGN]]
1254 // CHECK-NOT: !annotation
1255 // CHECK-NEXT: store double 0x400921FB54442D18, ptr %[[I]], align [[ALIGN]]
1256 // CHECK-NOT: !annotation
1257 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1259 TEST_UNINIT(volatileint
, volatile int);
1260 // CHECK-LABEL: @test_volatileint_uninit()
1261 // CHECK: %uninit = alloca i32, align
1262 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1263 // PATTERN-LABEL: @test_volatileint_uninit()
1264 // PATTERN: store volatile i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1265 // ZERO-LABEL: @test_volatileint_uninit()
1266 // ZERO: store volatile i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1268 TEST_BRACES(volatileint
, volatile int);
1269 // CHECK-LABEL: @test_volatileint_braces()
1270 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1271 // CHECK-NEXT: store volatile i32 0, ptr %braces, align [[ALIGN]]
1272 // CHECK-NOT: !annotation
1273 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1275 TEST_UNINIT(semivolatile
, semivolatile
);
1276 // CHECK-LABEL: @test_semivolatile_uninit()
1277 // CHECK: %uninit = alloca %struct.semivolatile, align
1278 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1279 // PATTERN-LABEL: @test_semivolatile_uninit()
1280 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_semivolatile_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1281 // ZERO-LABEL: @test_semivolatile_uninit()
1282 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1283 // ZERO-O1: store i64 0, ptr %uninit, align 8, !annotation [[AUTO_INIT]]
1285 TEST_BRACES(semivolatile
, semivolatile
);
1286 // CHECK-LABEL: @test_semivolatile_braces()
1287 // CHECK: %braces = alloca %struct.semivolatile, align [[ALIGN:[0-9]*]]
1288 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1289 // CHECK-NOT: !annotation
1290 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1292 TEST_CUSTOM(semivolatile
, semivolatile
, { 0x44444444, 0x44444444 });
1293 // CHECK-LABEL: @test_semivolatile_custom()
1294 // CHECK: %custom = alloca %struct.semivolatile, align
1295 // CHECK-O0: call void @llvm.memcpy
1296 // CHECK-NOT: !annotation
1297 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1298 // PATTERN-O1: store i32 1145324612, ptr %custom, align 4
1299 // PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw i8, ptr %custom, i64 4
1300 // PATTERN-O1-NEXT: store i32 1145324612, ptr %[[I]], align 4
1301 // ZERO-O1: store i64 4919131752989213764, ptr %custom, align 8
1302 // CHECK-NOT: !annotation
1304 TEST_UNINIT(semivolatileinit
, semivolatileinit
);
1305 // CHECK-LABEL: @test_semivolatileinit_uninit()
1306 // CHECK: %uninit = alloca %struct.semivolatileinit, align
1307 // CHECK-NEXT: call void @{{.*}}semivolatileinit{{.*}}%uninit)
1308 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1310 TEST_BRACES(semivolatileinit
, semivolatileinit
);
1311 // CHECK-LABEL: @test_semivolatileinit_braces()
1312 // CHECK: %braces = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
1313 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw %struct.semivolatileinit, ptr %braces, i32 0, i32 0
1314 // CHECK-NEXT: store i32 286331153, ptr %[[I]], align [[ALIGN]]
1315 // CHECK-NOT: !annotation
1316 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds nuw %struct.semivolatileinit, ptr %braces, i32 0, i32 1
1317 // CHECK-NEXT: store volatile i32 286331153, ptr %[[VI]], align [[ALIGN]]
1318 // CHECK-NOT: !annotation
1319 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1321 TEST_CUSTOM(semivolatileinit
, semivolatileinit
, { 0x44444444, 0x44444444 });
1322 // CHECK-LABEL: @test_semivolatileinit_custom()
1323 // CHECK: %custom = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]]
1324 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw %struct.semivolatileinit, ptr %custom, i32 0, i32 0
1325 // CHECK-NEXT: store i32 1145324612, ptr %[[I]], align [[ALIGN]]
1326 // CHECK-NOT: !annotation
1327 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds nuw %struct.semivolatileinit, ptr %custom, i32 0, i32 1
1328 // CHECK-NEXT: store volatile i32 1145324612, ptr %[[VI]], align [[ALIGN]]
1329 // CHECK-NOT: !annotation
1330 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1332 TEST_UNINIT(base
, base
);
1333 // CHECK-LABEL: @test_base_uninit()
1334 // CHECK: %uninit = alloca %struct.base, align
1335 // CHECK-NEXT: call void @{{.*}}base{{.*}}%uninit)
1336 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1337 // PATTERN-LABEL: @test_base_uninit()
1338 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_base_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1339 // ZERO-LABEL: @test_base_uninit()
1340 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1341 // ZERO-O1: store ptr getelementptr inbounds nuw inrange(-16, 16) (i8, ptr @_ZTV4base, i64 16), {{.*}}, align 8
1342 // ZERO-O1-NOT: !annotation
1344 TEST_BRACES(base
, base
);
1345 // CHECK-LABEL: @test_base_braces()
1346 // CHECK: %braces = alloca %struct.base, align [[ALIGN:[0-9]*]]
1347 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1348 // CHECK-NOT: !annotation
1349 // CHECK-NEXT: call void @{{.*}}base{{.*}}%braces)
1350 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1352 TEST_UNINIT(derived
, derived
);
1353 // CHECK-LABEL: @test_derived_uninit()
1354 // CHECK: %uninit = alloca %struct.derived, align
1355 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%uninit)
1356 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1357 // PATTERN-LABEL: @test_derived_uninit()
1358 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_derived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1359 // ZERO-LABEL: @test_derived_uninit()
1360 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1361 // ZERO-O1: store i64 0, {{.*}} align 8, !annotation [[AUTO_INIT]]
1362 // ZERO-O1: store ptr getelementptr inbounds nuw inrange(-16, 16) (i8, ptr @_ZTV7derived, i64 16), {{.*}} align 8
1364 TEST_BRACES(derived
, derived
);
1365 // CHECK-LABEL: @test_derived_braces()
1366 // CHECK: %braces = alloca %struct.derived, align [[ALIGN:[0-9]*]]
1367 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false)
1368 // CHECK-NOT: !annotation
1369 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%braces)
1370 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1372 TEST_UNINIT(virtualderived
, virtualderived
);
1373 // CHECK-LABEL: @test_virtualderived_uninit()
1374 // CHECK: %uninit = alloca %struct.virtualderived, align
1375 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%uninit)
1376 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1377 // PATTERN-LABEL: @test_virtualderived_uninit()
1378 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_virtualderived_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1379 // ZERO-LABEL: @test_virtualderived_uninit()
1380 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1381 // ZERO-O1: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1383 TEST_BRACES(virtualderived
, virtualderived
);
1384 // CHECK-LABEL: @test_virtualderived_braces()
1385 // CHECK: %braces = alloca %struct.virtualderived, align [[ALIGN:[0-9]*]]
1386 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false)
1387 // CHECK-NOT: !annotation
1388 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%braces)
1389 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1391 TEST_UNINIT(matching
, matching
);
1392 // CHECK-LABEL: @test_matching_uninit()
1393 // CHECK: %uninit = alloca %union.matching, align
1394 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1395 // PATTERN-LABEL: @test_matching_uninit()
1396 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matching_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1397 // ZERO-LABEL: @test_matching_uninit()
1398 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1399 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1401 TEST_BRACES(matching
, matching
);
1402 // CHECK-LABEL: @test_matching_braces()
1403 // CHECK: %braces = alloca %union.matching, align [[ALIGN:[0-9]*]]
1404 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1405 // CHECK-NOT: !annotation
1406 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1408 TEST_CUSTOM(matching
, matching
, { .f
= 0xf00f });
1409 // CHECK-LABEL: @test_matching_custom()
1410 // CHECK: %custom = alloca %union.matching, align
1411 // CHECK-O0: call void @llvm.memcpy
1412 // CHECK-NOT: !annotation
1413 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1414 // PATTERN-O1: store float 6.145500e+04, ptr {{.*}}, align 4
1415 // ZERO-O1: store i32 1198526208, ptr %custom, align 4
1416 // CHECK-NOT: !annotation
1418 TEST_UNINIT(matchingreverse
, matchingreverse
);
1419 // CHECK-LABEL: @test_matchingreverse_uninit()
1420 // CHECK: %uninit = alloca %union.matchingreverse, align
1421 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1422 // PATTERN-LABEL: @test_matchingreverse_uninit()
1423 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_matchingreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1424 // PATTERN-O1: store float 0xFFFFFFFFE0000000, {{.+}}, !annotation [[AUTO_INIT]]
1425 // ZERO-LABEL: @test_matchingreverse_uninit()
1426 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0,{{.+}}), !annotation [[AUTO_INIT]]
1427 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1429 TEST_BRACES(matchingreverse
, matchingreverse
);
1430 // CHECK-LABEL: @test_matchingreverse_braces()
1431 // CHECK: %braces = alloca %union.matchingreverse, align [[ALIGN:[0-9]*]]
1432 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1433 // CHECK-NOT: !annotation
1434 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1436 TEST_CUSTOM(matchingreverse
, matchingreverse
, { .i
= 0xf00f });
1437 // CHECK-LABEL: @test_matchingreverse_custom()
1438 // CHECK: %custom = alloca %union.matchingreverse, align
1439 // CHECK-O0: call void @llvm.memcpy
1440 // CHECK-NOT: !annotation
1441 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1442 // PATTERN-O1: store i32 61455, ptr %custom, align 4
1443 // ZERO-O1: store i32 61455, ptr %custom, align 4
1444 // CHECK-NOT: !annotation
1446 TEST_UNINIT(unmatched
, unmatched
);
1447 // CHECK-LABEL: @test_unmatched_uninit()
1448 // CHECK: %uninit = alloca %union.unmatched, align
1449 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1450 // PATTERN-LABEL: @test_unmatched_uninit()
1451 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatched_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1452 // ZERO-LABEL: @test_unmatched_uninit()
1453 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1454 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1456 TEST_BRACES(unmatched
, unmatched
);
1457 // CHECK-LABEL: @test_unmatched_braces()
1458 // CHECK: %braces = alloca %union.unmatched, align
1459 // CHECK-NEXT: call void @llvm.memcpy
1460 // CHECK-NOT: !annotation
1461 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1463 TEST_CUSTOM(unmatched
, unmatched
, { .i
= 0x3badbeef });
1464 // CHECK-LABEL: @test_unmatched_custom()
1465 // CHECK: %custom = alloca %union.unmatched, align
1466 // CHECK-O0: call void @llvm.memcpy
1467 // CHECK-NOT: !annotation
1468 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1469 // PATTERN-O1: store i32 1001242351, ptr {{.*}}, align 4
1470 // ZERO-O1: store i32 1001242351, ptr {{.*}}, align 4
1471 // CHECK-NOT: !annotation
1473 TEST_UNINIT(unmatchedreverse
, unmatchedreverse
);
1474 // CHECK-LABEL: @test_unmatchedreverse_uninit()
1475 // CHECK: %uninit = alloca %union.unmatchedreverse, align
1476 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1477 // PATTERN-LABEL: @test_unmatchedreverse_uninit()
1478 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedreverse_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1479 // ZERO-LABEL: @test_unmatchedreverse_uninit()
1480 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1481 // ZERO-O1: store i32 0, {{.*}} align 4, !annotation [[AUTO_INIT]]
1483 TEST_BRACES(unmatchedreverse
, unmatchedreverse
);
1484 // CHECK-LABEL: @test_unmatchedreverse_braces()
1485 // CHECK: %braces = alloca %union.unmatchedreverse, align [[ALIGN:[0-9]*]]
1486 // CHECK-NEXT: call void @llvm.memset{{.*}}(ptr align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false)
1487 // CHECK-NOT: !annotation
1488 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1490 TEST_CUSTOM(unmatchedreverse
, unmatchedreverse
, { .c
= 42 });
1491 // CHECK-LABEL: @test_unmatchedreverse_custom()
1492 // CHECK: %custom = alloca %union.unmatchedreverse, align
1493 // CHECK-O0: call void @llvm.memcpy
1494 // CHECK-NOT: !annotation
1495 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1496 // PATTERN-O1: store i8 42, ptr {{.*}}, align 4
1497 // PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw i8, ptr %custom, i64 1
1498 // PATTERN-O1-NEXT: store i8 -86, ptr %[[I]], align {{.*}}
1499 // PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw i8, ptr %custom, i64 2
1500 // PATTERN-O1-NEXT: store i8 -86, ptr %[[I]], align {{.*}}
1501 // PATTERN-O1-NEXT: %[[I:[^ ]*]] = getelementptr inbounds nuw i8, ptr %custom, i64 3
1502 // PATTERN-O1-NEXT: store i8 -86, ptr %[[I]], align {{.*}}
1503 // ZERO-O1: store i32 42, ptr {{.*}}, align 4
1505 TEST_UNINIT(unmatchedfp
, unmatchedfp
);
1506 // CHECK-LABEL: @test_unmatchedfp_uninit()
1507 // CHECK: %uninit = alloca %union.unmatchedfp, align
1508 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1509 // PATTERN-LABEL: @test_unmatchedfp_uninit()
1510 // PATTERN-O0: call void @llvm.memcpy{{.*}} @__const.test_unmatchedfp_uninit.uninit{{.+}}), !annotation [[AUTO_INIT]]
1511 // ZERO-LABEL: @test_unmatchedfp_uninit()
1512 // ZERO-O0: call void @llvm.memset{{.*}}, i8 0, {{.+}}), !annotation [[AUTO_INIT]]
1513 // ZERO-O1: store i64 0, {{.*}} align 8, !annotation [[AUTO_INIT]]
1515 TEST_BRACES(unmatchedfp
, unmatchedfp
);
1516 // CHECK-LABEL: @test_unmatchedfp_braces()
1517 // CHECK: %braces = alloca %union.unmatchedfp, align
1518 // CHECK-NEXT: call void @llvm.memcpy
1519 // CHECK-NOT: !annotation
1520 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1522 TEST_CUSTOM(unmatchedfp
, unmatchedfp
, { .d
= 3.1415926535897932384626433 });
1523 // CHECK-LABEL: @test_unmatchedfp_custom()
1524 // CHECK: %custom = alloca %union.unmatchedfp, align
1525 // CHECK-O0: call void @llvm.memcpy
1526 // CHECK-NOT: !annotation
1527 // CHECK-O0: call void @{{.*}}used{{.*}}%custom)
1528 // PATTERN-O1: store double 0x400921FB54442D18, ptr %custom, align 8
1529 // ZERO-O1: store i64 4614256656552045848, ptr %custom, align 8
1530 // CHECK-NOT: !annotation
1532 TEST_UNINIT(emptyenum
, emptyenum
);
1533 // CHECK-LABEL: @test_emptyenum_uninit()
1534 // CHECK: %uninit = alloca i32, align
1535 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1536 // PATTERN-LABEL: @test_emptyenum_uninit()
1537 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1538 // ZERO-LABEL: @test_emptyenum_uninit()
1539 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1541 TEST_BRACES(emptyenum
, emptyenum
);
1542 // CHECK-LABEL: @test_emptyenum_braces()
1543 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1544 // CHECK-NOT: !annotation
1545 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
1546 // CHECK-NOT: !annotation
1547 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1549 TEST_CUSTOM(emptyenum
, emptyenum
, { (emptyenum
)42 });
1550 // CHECK-LABEL: @test_emptyenum_custom()
1551 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]]
1552 // CHECK-NEXT: store i32 42, ptr %custom, align [[ALIGN]]
1553 // CHECK-NOT: !annotation
1554 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1556 TEST_UNINIT(smallenum
, smallenum
);
1557 // CHECK-LABEL: @test_smallenum_uninit()
1558 // CHECK: %uninit = alloca i32, align
1559 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1560 // PATTERN-LABEL: @test_smallenum_uninit()
1561 // PATTERN: store i32 [[I32]], ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1562 // ZERO-LABEL: @test_smallenum_uninit()
1563 // ZERO: store i32 0, ptr %uninit, align 4, !annotation [[AUTO_INIT]]
1565 TEST_BRACES(smallenum
, smallenum
);
1566 // CHECK-LABEL: @test_smallenum_braces()
1567 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]]
1568 // CHECK-NEXT: store i32 0, ptr %braces, align [[ALIGN]]
1569 // CHECK-NOT: !annotation
1570 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1572 TEST_CUSTOM(smallenum
, smallenum
, { (smallenum
)42 });
1573 // CHECK-LABEL: @test_smallenum_custom()
1574 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]]
1575 // CHECK-NEXT: store i32 42, ptr %custom, align [[ALIGN]]
1576 // CHECK-NOT: !annotation
1577 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1579 TEST_UNINIT(intvec16
, int __attribute__((vector_size(16))));
1580 // CHECK-LABEL: @test_intvec16_uninit()
1581 // CHECK: %uninit = alloca <4 x i32>, align
1582 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1583 // PATTERN-LABEL: @test_intvec16_uninit()
1584 // PATTERN: store <4 x i32> splat (i32 [[I32]]), ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1585 // ZERO-LABEL: @test_intvec16_uninit()
1586 // ZERO: store <4 x i32> zeroinitializer, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1588 TEST_BRACES(intvec16
, int __attribute__((vector_size(16))));
1589 // CHECK-LABEL: @test_intvec16_braces()
1590 // CHECK: %braces = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
1591 // CHECK-NEXT: store <4 x i32> zeroinitializer, ptr %braces, align [[ALIGN]]
1592 // CHECK-NOT: !annotation
1593 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1595 TEST_CUSTOM(intvec16
, int __attribute__((vector_size(16))), { 0x44444444, 0x44444444, 0x44444444, 0x44444444 });
1596 // CHECK-LABEL: @test_intvec16_custom()
1597 // CHECK: %custom = alloca <4 x i32>, align [[ALIGN:[0-9]*]]
1598 // CHECK-NEXT: store <4 x i32> splat (i32 1145324612), ptr %custom, align [[ALIGN]]
1599 // CHECK-NOT: !annotation
1600 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1602 TEST_UNINIT(longlongvec32
, long long __attribute__((vector_size(32))));
1603 // CHECK-LABEL: @test_longlongvec32_uninit()
1604 // CHECK: %uninit = alloca <4 x i64>, align
1605 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1606 // PATTERN-LABEL: @test_longlongvec32_uninit()
1607 // PATTERN: store <4 x i64> splat (i64 [[I64]]), ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1608 // ZERO-LABEL: @test_longlongvec32_uninit()
1609 // ZERO: store <4 x i64> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1611 TEST_BRACES(longlongvec32
, long long __attribute__((vector_size(32))));
1612 // CHECK-LABEL: @test_longlongvec32_braces()
1613 // CHECK: %braces = alloca <4 x i64>, align [[ALIGN:[0-9]*]]
1614 // CHECK-NEXT: store <4 x i64> zeroinitializer, ptr %braces, align [[ALIGN]]
1615 // CHECK-NOT: !annotation
1616 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1618 TEST_CUSTOM(longlongvec32
, long long __attribute__((vector_size(32))), { 0x3333333333333333, 0x3333333333333333, 0x3333333333333333, 0x3333333333333333 });
1619 // CHECK-LABEL: @test_longlongvec32_custom()
1620 // CHECK: %custom = alloca <4 x i64>, align [[ALIGN:[0-9]*]]
1621 // CHECK-NEXT: store <4 x i64> splat (i64 3689348814741910323), ptr %custom, align [[ALIGN]]
1622 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1624 TEST_UNINIT(floatvec16
, float __attribute__((vector_size(16))));
1625 // CHECK-LABEL: @test_floatvec16_uninit()
1626 // CHECK: %uninit = alloca <4 x float>, align
1627 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1628 // PATTERN-LABEL: @test_floatvec16_uninit()
1629 // PATTERN: store <4 x float> splat (float 0xFFFFFFFFE0000000), ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1630 // ZERO-LABEL: @test_floatvec16_uninit()
1631 // ZERO: store <4 x float> zeroinitializer, ptr %uninit, align 16, !annotation [[AUTO_INIT]]
1633 TEST_BRACES(floatvec16
, float __attribute__((vector_size(16))));
1634 // CHECK-LABEL: @test_floatvec16_braces()
1635 // CHECK: %braces = alloca <4 x float>, align [[ALIGN:[0-9]*]]
1636 // CHECK-NEXT: store <4 x float> zeroinitializer, ptr %braces, align [[ALIGN]]
1637 // CHECK-NOT: !annotation
1638 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1640 TEST_CUSTOM(floatvec16
, float __attribute__((vector_size(16))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
1641 // CHECK-LABEL: @test_floatvec16_custom()
1642 // CHECK: %custom = alloca <4 x float>, align [[ALIGN:[0-9]*]]
1643 // CHECK-NEXT: store <4 x float> splat (float 0x400921FB60000000), ptr %custom, align [[ALIGN]]
1644 // CHECK-NOT: !annotation
1645 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1647 TEST_UNINIT(doublevec32
, double __attribute__((vector_size(32))));
1648 // CHECK-LABEL: @test_doublevec32_uninit()
1649 // CHECK: %uninit = alloca <4 x double>, align
1650 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1651 // PATTERN-LABEL: @test_doublevec32_uninit()
1652 // PATTERN: store <4 x double> splat (double 0xFFFFFFFFFFFFFFFF), ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1653 // ZERO-LABEL: @test_doublevec32_uninit()
1654 // ZERO: store <4 x double> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1656 TEST_BRACES(doublevec32
, double __attribute__((vector_size(32))));
1657 // CHECK-LABEL: @test_doublevec32_braces()
1658 // CHECK: %braces = alloca <4 x double>, align [[ALIGN:[0-9]*]]
1659 // CHECK-NEXT: store <4 x double> zeroinitializer, ptr %braces, align [[ALIGN]]
1660 // CHECK-NOT: !annotation
1661 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces)
1663 TEST_CUSTOM(doublevec32
, double __attribute__((vector_size(32))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 });
1664 // CHECK-LABEL: @test_doublevec32_custom()
1665 // CHECK: %custom = alloca <4 x double>, align [[ALIGN:[0-9]*]]
1666 // CHECK-NEXT: store <4 x double> splat (double 0x400921FB54442D18), ptr %custom, align [[ALIGN]]
1667 // CHECK-NOT: !annotation
1668 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom)
1670 // TODO: This vector has tail padding
1671 TEST_UNINIT(doublevec24
, double __attribute__((vector_size(24))));
1672 // CHECK-LABEL: @test_doublevec24_uninit()
1673 // CHECK: %uninit = alloca <3 x double>, align
1674 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1675 // PATTERN-LABEL: @test_doublevec24_uninit()
1676 // PATTERN: store <3 x double> splat (double 0xFFFFFFFFFFFFFFFF), ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1677 // ZERO-LABEL: @test_doublevec24_uninit()
1678 // ZERO: store <3 x double> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1680 // TODO: This vector has tail padding
1681 TEST_UNINIT(longdoublevec32
, long double __attribute__((vector_size(sizeof(long double)*2))));
1682 // CHECK-LABEL: @test_longdoublevec32_uninit()
1683 // CHECK: %uninit = alloca <2 x x86_fp80>, align
1684 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit)
1685 // PATTERN-LABEL: @test_longdoublevec32_uninit()
1686 // PATTERN: store <2 x x86_fp80> splat (x86_fp80 0xKFFFFFFFFFFFFFFFFFFFF), ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1687 // ZERO-LABEL: @test_longdoublevec32_uninit()
1688 // ZERO: store <2 x x86_fp80> zeroinitializer, ptr %uninit, align 32, !annotation [[AUTO_INIT]]
1692 // PATTERN: [[AUTO_INIT]] = !{!"auto-init"}
1693 // ZERO: [[AUTO_INIT]] = !{!"auto-init"}