1 // RUN: %clang_cc1 -triple x86_64-unknown-unknown -fblocks %s -emit-llvm -o - | FileCheck %s 2 3 template<typename T> void used(T &) noexcept; 4 5 #define TEST_UNINIT(NAME, TYPE) \ 6 using type_##NAME = TYPE; \ 7 void test_##NAME##_uninit() { \ 8 type_##NAME uninit; \ 9 used(uninit); \ 10 } 11 12 // Value initialization on scalars, aggregate initialization on aggregates. 13 #define TEST_BRACES(NAME, TYPE) \ 14 using type_##NAME = TYPE; \ 15 void test_##NAME##_braces() { \ 16 type_##NAME braces = {}; \ 17 used(braces); \ 18 } 19 20 #define TEST_CUSTOM(NAME, TYPE, ...) \ 21 using type_##NAME = TYPE; \ 22 void test_##NAME##_custom() { \ 23 type_##NAME custom __VA_ARGS__; \ 24 used(custom); \ 25 } 26 27 struct empty {}; 28 struct small { char c; }; 29 struct smallinit { char c = 42; }; 30 struct smallpartinit { char c = 42, d; }; 31 struct nullinit { char* null = nullptr; }; 32 struct padded { char c; int i; }; 33 struct paddednullinit { char c = 0; int i = 0; }; 34 struct bitfield { int i : 4; int j : 2; }; 35 struct bitfieldaligned { int i : 4; int : 0; int j : 2; }; 36 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; }; 37 struct arraytail { int i; int arr[]; }; 38 struct tailpad { short s; char c; }; 39 struct notlockfree { long long a[4]; }; 40 struct semivolatile { int i; volatile int vi; }; 41 struct semivolatileinit { int i = 0x11111111; volatile int vi = 0x11111111; }; 42 struct base { virtual ~base(); }; 43 struct derived : public base {}; 44 struct virtualderived : public virtual base, public virtual derived {}; 45 union matching { int i; float f; }; 46 union matchingreverse { float f; int i; }; 47 union unmatched { char c; int i; }; 48 union unmatchedreverse { int i; char c; }; 49 union unmatchedfp { float f; double d; }; 50 enum emptyenum {}; 51 enum smallenum { VALUE }; 52 53 extern "C" { 54 55 TEST_UNINIT(char, char); 56 // CHECK-LABEL: @test_char_uninit() 57 // CHECK: %uninit = alloca i8, align 58 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 59 60 TEST_BRACES(char, char); 61 // CHECK-LABEL: @test_char_braces() 62 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]] 63 // CHECK-NEXT: store i8 0, i8* %braces, align [[ALIGN]] 64 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 65 66 TEST_UNINIT(uchar, unsigned char); 67 // CHECK-LABEL: @test_uchar_uninit() 68 // CHECK: %uninit = alloca i8, align 69 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 70 71 TEST_BRACES(uchar, unsigned char); 72 // CHECK-LABEL: @test_uchar_braces() 73 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]] 74 // CHECK-NEXT: store i8 0, i8* %braces, align [[ALIGN]] 75 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 76 77 TEST_UNINIT(schar, signed char); 78 // CHECK-LABEL: @test_schar_uninit() 79 // CHECK: %uninit = alloca i8, align 80 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 81 82 TEST_BRACES(schar, signed char); 83 // CHECK-LABEL: @test_schar_braces() 84 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]] 85 // CHECK-NEXT: store i8 0, i8* %braces, align [[ALIGN]] 86 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 87 88 TEST_UNINIT(wchar_t, wchar_t); 89 // CHECK-LABEL: @test_wchar_t_uninit() 90 // CHECK: %uninit = alloca i32, align 91 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 92 93 TEST_BRACES(wchar_t, wchar_t); 94 // CHECK-LABEL: @test_wchar_t_braces() 95 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 96 // CHECK-NEXT: store i32 0, i32* %braces, align [[ALIGN]] 97 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 98 99 TEST_UNINIT(short, short); 100 // CHECK-LABEL: @test_short_uninit() 101 // CHECK: %uninit = alloca i16, align 102 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 103 104 TEST_BRACES(short, short); 105 // CHECK-LABEL: @test_short_braces() 106 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]] 107 // CHECK-NEXT: store i16 0, i16* %braces, align [[ALIGN]] 108 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 109 110 TEST_UNINIT(ushort, unsigned short); 111 // CHECK-LABEL: @test_ushort_uninit() 112 // CHECK: %uninit = alloca i16, align 113 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 114 115 TEST_BRACES(ushort, unsigned short); 116 // CHECK-LABEL: @test_ushort_braces() 117 // CHECK: %braces = alloca i16, align [[ALIGN:[0-9]*]] 118 // CHECK-NEXT: store i16 0, i16* %braces, align [[ALIGN]] 119 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 120 121 TEST_UNINIT(int, int); 122 // CHECK-LABEL: @test_int_uninit() 123 // CHECK: %uninit = alloca i32, align 124 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 125 126 TEST_BRACES(int, int); 127 // CHECK-LABEL: @test_int_braces() 128 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 129 // CHECK-NEXT: store i32 0, i32* %braces, align [[ALIGN]] 130 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 131 132 TEST_UNINIT(unsigned, unsigned); 133 // CHECK-LABEL: @test_unsigned_uninit() 134 // CHECK: %uninit = alloca i32, align 135 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 136 137 TEST_BRACES(unsigned, unsigned); 138 // CHECK-LABEL: @test_unsigned_braces() 139 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 140 // CHECK-NEXT: store i32 0, i32* %braces, align [[ALIGN]] 141 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 142 143 TEST_UNINIT(long, long); 144 // CHECK-LABEL: @test_long_uninit() 145 // CHECK: %uninit = alloca i64, align 146 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 147 148 TEST_BRACES(long, long); 149 // CHECK-LABEL: @test_long_braces() 150 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]] 151 // CHECK-NEXT: store i64 0, i64* %braces, align [[ALIGN]] 152 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 153 154 TEST_UNINIT(ulong, unsigned long); 155 // CHECK-LABEL: @test_ulong_uninit() 156 // CHECK: %uninit = alloca i64, align 157 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 158 159 TEST_BRACES(ulong, unsigned long); 160 // CHECK-LABEL: @test_ulong_braces() 161 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]] 162 // CHECK-NEXT: store i64 0, i64* %braces, align [[ALIGN]] 163 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 164 165 TEST_UNINIT(longlong, long long); 166 // CHECK-LABEL: @test_longlong_uninit() 167 // CHECK: %uninit = alloca i64, align 168 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 169 170 TEST_BRACES(longlong, long long); 171 // CHECK-LABEL: @test_longlong_braces() 172 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]] 173 // CHECK-NEXT: store i64 0, i64* %braces, align [[ALIGN]] 174 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 175 176 TEST_UNINIT(ulonglong, unsigned long long); 177 // CHECK-LABEL: @test_ulonglong_uninit() 178 // CHECK: %uninit = alloca i64, align 179 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 180 181 TEST_BRACES(ulonglong, unsigned long long); 182 // CHECK-LABEL: @test_ulonglong_braces() 183 // CHECK: %braces = alloca i64, align [[ALIGN:[0-9]*]] 184 // CHECK-NEXT: store i64 0, i64* %braces, align [[ALIGN]] 185 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 186 187 TEST_UNINIT(int128, __int128); 188 // CHECK-LABEL: @test_int128_uninit() 189 // CHECK: %uninit = alloca i128, align 190 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 191 192 TEST_BRACES(int128, __int128); 193 // CHECK-LABEL: @test_int128_braces() 194 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]] 195 // CHECK-NEXT: store i128 0, i128* %braces, align [[ALIGN]] 196 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 197 198 TEST_UNINIT(uint128, unsigned __int128); 199 // CHECK-LABEL: @test_uint128_uninit() 200 // CHECK: %uninit = alloca i128, align 201 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 202 203 TEST_BRACES(uint128, unsigned __int128); 204 // CHECK-LABEL: @test_uint128_braces() 205 // CHECK: %braces = alloca i128, align [[ALIGN:[0-9]*]] 206 // CHECK-NEXT: store i128 0, i128* %braces, align [[ALIGN]] 207 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 208 209 210 TEST_UNINIT(fp16, __fp16); 211 // CHECK-LABEL: @test_fp16_uninit() 212 // CHECK: %uninit = alloca half, align 213 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 214 215 TEST_BRACES(fp16, __fp16); 216 // CHECK-LABEL: @test_fp16_braces() 217 // CHECK: %braces = alloca half, align [[ALIGN:[0-9]*]] 218 // CHECK-NEXT: store half 0xH0000, half* %braces, align [[ALIGN]] 219 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 220 221 TEST_UNINIT(float, float); 222 // CHECK-LABEL: @test_float_uninit() 223 // CHECK: %uninit = alloca float, align 224 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 225 226 TEST_BRACES(float, float); 227 // CHECK-LABEL: @test_float_braces() 228 // CHECK: %braces = alloca float, align [[ALIGN:[0-9]*]] 229 // CHECK-NEXT: store float 0.000000e+00, float* %braces, align [[ALIGN]] 230 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 231 232 TEST_UNINIT(double, double); 233 // CHECK-LABEL: @test_double_uninit() 234 // CHECK: %uninit = alloca double, align 235 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 236 237 TEST_BRACES(double, double); 238 // CHECK-LABEL: @test_double_braces() 239 // CHECK: %braces = alloca double, align [[ALIGN:[0-9]*]] 240 // CHECK-NEXT: store double 0.000000e+00, double* %braces, align [[ALIGN]] 241 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 242 243 TEST_UNINIT(longdouble, long double); 244 // CHECK-LABEL: @test_longdouble_uninit() 245 // CHECK: %uninit = alloca x86_fp80, align 246 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 247 248 TEST_BRACES(longdouble, long double); 249 // CHECK-LABEL: @test_longdouble_braces() 250 // CHECK: %braces = alloca x86_fp80, align [[ALIGN:[0-9]*]] 251 // CHECK-NEXT: store x86_fp80 0xK00000000000000000000, x86_fp80* %braces, align [[ALIGN]] 252 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 253 254 255 TEST_UNINIT(intptr, int*); 256 // CHECK-LABEL: @test_intptr_uninit() 257 // CHECK: %uninit = alloca i32*, align 258 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 259 260 TEST_BRACES(intptr, int*); 261 // CHECK-LABEL: @test_intptr_braces() 262 // CHECK: %braces = alloca i32*, align [[ALIGN:[0-9]*]] 263 // CHECK-NEXT: store i32* null, i32** %braces, align [[ALIGN]] 264 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 265 266 TEST_UNINIT(intptrptr, int**); 267 // CHECK-LABEL: @test_intptrptr_uninit() 268 // CHECK: %uninit = alloca i32**, align 269 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 270 271 TEST_BRACES(intptrptr, int**); 272 // CHECK-LABEL: @test_intptrptr_braces() 273 // CHECK: %braces = alloca i32**, align [[ALIGN:[0-9]*]] 274 // CHECK-NEXT: store i32** null, i32*** %braces, align [[ALIGN]] 275 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 276 277 TEST_UNINIT(function, void(*)()); 278 // CHECK-LABEL: @test_function_uninit() 279 // CHECK: %uninit = alloca void ()*, align 280 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 281 282 TEST_BRACES(function, void(*)()); 283 // CHECK-LABEL: @test_function_braces() 284 // CHECK: %braces = alloca void ()*, align [[ALIGN:[0-9]*]] 285 // CHECK-NEXT: store void ()* null, void ()** %braces, align [[ALIGN]] 286 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 287 288 TEST_UNINIT(bool, bool); 289 // CHECK-LABEL: @test_bool_uninit() 290 // CHECK: %uninit = alloca i8, align 291 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 292 293 TEST_BRACES(bool, bool); 294 // CHECK-LABEL: @test_bool_braces() 295 // CHECK: %braces = alloca i8, align [[ALIGN:[0-9]*]] 296 // CHECK-NEXT: store i8 0, i8* %braces, align [[ALIGN]] 297 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 298 299 300 TEST_UNINIT(empty, empty); 301 // CHECK-LABEL: @test_empty_uninit() 302 // CHECK: %uninit = alloca %struct.empty, align 303 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 304 305 TEST_BRACES(empty, empty); 306 // CHECK-LABEL: @test_empty_braces() 307 // CHECK: %braces = alloca %struct.empty, align 308 // CHECK-NEXT: bitcast 309 // CHECK-NEXT: call void @llvm.memcpy 310 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 311 312 TEST_UNINIT(small, small); 313 // CHECK-LABEL: @test_small_uninit() 314 // CHECK: %uninit = alloca %struct.small, align 315 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 316 317 TEST_BRACES(small, small); 318 // CHECK-LABEL: @test_small_braces() 319 // CHECK: %braces = alloca %struct.small, align [[ALIGN:[0-9]*]] 320 // CHECK-NEXT: bitcast 321 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 1, i1 false) 322 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 323 324 TEST_CUSTOM(small, small, { 42 }); 325 // CHECK-LABEL: @test_small_custom() 326 // CHECK: %custom = alloca %struct.small, align 327 // CHECK-NEXT: bitcast 328 // CHECK-NEXT: call void @llvm.memcpy 329 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 330 331 TEST_UNINIT(smallinit, smallinit); 332 // CHECK-LABEL: @test_smallinit_uninit() 333 // CHECK: %uninit = alloca %struct.smallinit, align 334 // CHECK-NEXT: call void @{{.*}}smallinit{{.*}}%uninit) 335 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 336 337 TEST_BRACES(smallinit, smallinit); 338 // CHECK-LABEL: @test_smallinit_braces() 339 // CHECK: %braces = alloca %struct.smallinit, align [[ALIGN:[0-9]*]] 340 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, %struct.smallinit* %braces, i32 0, i32 0 341 // CHECK-NEXT: store i8 42, i8* %[[C]], align [[ALIGN]] 342 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 343 344 TEST_CUSTOM(smallinit, smallinit, { 100 }); 345 // CHECK-LABEL: @test_smallinit_custom() 346 // CHECK: %custom = alloca %struct.smallinit, align [[ALIGN:[0-9]*]] 347 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallinit, %struct.smallinit* %custom, i32 0, i32 0 348 // CHECK-NEXT: store i8 100, i8* %[[C]], align [[ALIGN]] 349 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 350 351 TEST_UNINIT(smallpartinit, smallpartinit); 352 // CHECK-LABEL: @test_smallpartinit_uninit() 353 // CHECK: %uninit = alloca %struct.smallpartinit, align 354 // CHECK-NEXT: call void @{{.*}}smallpartinit{{.*}}%uninit) 355 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 356 357 TEST_BRACES(smallpartinit, smallpartinit); 358 // CHECK-LABEL: @test_smallpartinit_braces() 359 // CHECK: %braces = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]] 360 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %braces, i32 0, i32 0 361 // CHECK-NEXT: store i8 42, i8* %[[C]], align [[ALIGN]] 362 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %braces, i32 0, i32 1 363 // CHECK-NEXT: store i8 0, i8* %[[D]], align [[ALIGN]] 364 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 365 366 TEST_CUSTOM(smallpartinit, smallpartinit, { 100, 42 }); 367 // CHECK-LABEL: @test_smallpartinit_custom() 368 // CHECK: %custom = alloca %struct.smallpartinit, align [[ALIGN:[0-9]*]] 369 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %custom, i32 0, i32 0 370 // CHECK-NEXT: store i8 100, i8* %[[C]], align [[ALIGN]] 371 // CHECK-NEXT: %[[D:[^ ]*]] = getelementptr inbounds %struct.smallpartinit, %struct.smallpartinit* %custom, i32 0, i32 1 372 // CHECK-NEXT: store i8 42, i8* %[[D]], align [[ALIGN]] 373 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 374 375 TEST_UNINIT(nullinit, nullinit); 376 // CHECK-LABEL: @test_nullinit_uninit() 377 // CHECK: %uninit = alloca %struct.nullinit, align 378 // CHECK-NEXT: call void @{{.*}}nullinit{{.*}}%uninit) 379 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 380 381 TEST_BRACES(nullinit, nullinit); 382 // CHECK-LABEL: @test_nullinit_braces() 383 // CHECK: %braces = alloca %struct.nullinit, align [[ALIGN:[0-9]*]] 384 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, %struct.nullinit* %braces, i32 0, i32 0 385 // CHECK-NEXT: store i8* null, i8** %[[N]], align [[ALIGN]] 386 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 387 388 TEST_CUSTOM(nullinit, nullinit, { (char*)"derp" }); 389 // CHECK-LABEL: @test_nullinit_custom() 390 // CHECK: %custom = alloca %struct.nullinit, align [[ALIGN:[0-9]*]] 391 // CHECK-NEXT: %[[N:[^ ]*]] = getelementptr inbounds %struct.nullinit, %struct.nullinit* %custom, i32 0, i32 0 392 // CHECK-NEXT: store i8* getelementptr inbounds {{.*}}, i8** %[[N]], align [[ALIGN]] 393 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 394 395 TEST_UNINIT(padded, padded); 396 // CHECK-LABEL: @test_padded_uninit() 397 // CHECK: %uninit = alloca %struct.padded, align 398 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 399 400 TEST_BRACES(padded, padded); 401 // CHECK-LABEL: @test_padded_braces() 402 // CHECK: %braces = alloca %struct.padded, align [[ALIGN:[0-9]*]] 403 // CHECK-NEXT: bitcast 404 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false) 405 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 406 407 TEST_CUSTOM(padded, padded, { 42, 13371337 }); 408 // CHECK-LABEL: @test_padded_custom() 409 // CHECK: %custom = alloca %struct.padded, align 410 // CHECK-NEXT: bitcast 411 // CHECK-NEXT: call void @llvm.memcpy 412 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 413 414 TEST_UNINIT(paddednullinit, paddednullinit); 415 // CHECK-LABEL: @test_paddednullinit_uninit() 416 // CHECK: %uninit = alloca %struct.paddednullinit, align 417 // CHECK-NEXT: call void @{{.*}}paddednullinit{{.*}}%uninit) 418 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 419 420 TEST_BRACES(paddednullinit, paddednullinit); 421 // CHECK-LABEL: @test_paddednullinit_braces() 422 // CHECK: %braces = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]] 423 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %braces, i32 0, i32 0 424 // CHECK-NEXT: store i8 0, i8* %[[C]], align [[ALIGN]] 425 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %braces, i32 0, i32 1 426 // CHECK-NEXT: store i32 0, i32* %[[I]], align [[ALIGN]] 427 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 428 429 TEST_CUSTOM(paddednullinit, paddednullinit, { 42, 13371337 }); 430 // CHECK-LABEL: @test_paddednullinit_custom() 431 // CHECK: %custom = alloca %struct.paddednullinit, align [[ALIGN:[0-9]*]] 432 // CHECK-NEXT: %[[C:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %custom, i32 0, i32 0 433 // CHECK-NEXT: store i8 42, i8* %[[C]], align [[ALIGN]] 434 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.paddednullinit, %struct.paddednullinit* %custom, i32 0, i32 1 435 // CHECK-NEXT: store i32 13371337, i32* %[[I]], align [[ALIGN]] 436 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 437 438 TEST_UNINIT(bitfield, bitfield); 439 // CHECK-LABEL: @test_bitfield_uninit() 440 // CHECK: %uninit = alloca %struct.bitfield, align 441 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 442 443 TEST_BRACES(bitfield, bitfield); 444 // CHECK-LABEL: @test_bitfield_braces() 445 // CHECK: %braces = alloca %struct.bitfield, align 446 // CHECK-NEXT: bitcast 447 // CHECK-NEXT: call void @llvm.memcpy 448 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 449 450 TEST_CUSTOM(bitfield, bitfield, { 4, 1 }); 451 // CHECK-LABEL: @test_bitfield_custom() 452 // CHECK: %custom = alloca %struct.bitfield, align 453 // CHECK-NEXT: bitcast 454 // CHECK-NEXT: call void @llvm.memcpy 455 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 456 457 TEST_UNINIT(bitfieldaligned, bitfieldaligned); 458 // CHECK-LABEL: @test_bitfieldaligned_uninit() 459 // CHECK: %uninit = alloca %struct.bitfieldaligned, align 460 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 461 462 TEST_BRACES(bitfieldaligned, bitfieldaligned); 463 // CHECK-LABEL: @test_bitfieldaligned_braces() 464 // CHECK: %braces = alloca %struct.bitfieldaligned, align 465 // CHECK-NEXT: bitcast 466 // CHECK-NEXT: call void @llvm.memcpy 467 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 468 469 TEST_CUSTOM(bitfieldaligned, bitfieldaligned, { 4, 1 }); 470 // CHECK-LABEL: @test_bitfieldaligned_custom() 471 // CHECK: %custom = alloca %struct.bitfieldaligned, align 472 // CHECK-NEXT: bitcast 473 // CHECK-NEXT: call void @llvm.memcpy 474 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 475 476 TEST_UNINIT(big, big); 477 // CHECK-LABEL: @test_big_uninit() 478 // CHECK: %uninit = alloca %struct.big, align 479 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 480 481 TEST_BRACES(big, big); 482 // CHECK-LABEL: @test_big_braces() 483 // CHECK: %braces = alloca %struct.big, align [[ALIGN:[0-9]*]] 484 // CHECK-NEXT: bitcast 485 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 104, i1 false) 486 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 487 488 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 }); 489 // CHECK-LABEL: @test_big_custom() 490 // CHECK: %custom = alloca %struct.big, align [[ALIGN:[0-9]*]] 491 // CHECK-NEXT: bitcast 492 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 -86, i64 104, i1 false) 493 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 494 495 TEST_UNINIT(arraytail, arraytail); 496 // CHECK-LABEL: @test_arraytail_uninit() 497 // CHECK: %uninit = alloca %struct.arraytail, align 498 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 499 500 TEST_BRACES(arraytail, arraytail); 501 // CHECK-LABEL: @test_arraytail_braces() 502 // CHECK: %braces = alloca %struct.arraytail, align [[ALIGN:[0-9]*]] 503 // CHECK-NEXT: bitcast 504 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 505 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 506 507 TEST_CUSTOM(arraytail, arraytail, { 0xdead }); 508 // CHECK-LABEL: @test_arraytail_custom() 509 // CHECK: %custom = alloca %struct.arraytail, align 510 // CHECK-NEXT: bitcast 511 // CHECK-NEXT: call void @llvm.memcpy 512 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 513 514 515 TEST_UNINIT(int0, int[0]); 516 // CHECK-LABEL: @test_int0_uninit() 517 // CHECK: %uninit = alloca [0 x i32], align 518 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 519 520 TEST_BRACES(int0, int[0]); 521 // CHECK-LABEL: @test_int0_braces() 522 // CHECK: %braces = alloca [0 x i32], align [[ALIGN:[0-9]*]] 523 // CHECK-NEXT: bitcast 524 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 0, i1 false) 525 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 526 527 TEST_UNINIT(int1, int[1]); 528 // CHECK-LABEL: @test_int1_uninit() 529 // CHECK: %uninit = alloca [1 x i32], align [[ALIGN:[0-9]*]] 530 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 531 532 TEST_BRACES(int1, int[1]); 533 // CHECK-LABEL: @test_int1_braces() 534 // CHECK: %braces = alloca [1 x i32], align [[ALIGN:[0-9]*]] 535 // CHECK-NEXT: bitcast 536 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 537 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 538 539 TEST_CUSTOM(int1, int[1], { 0x33333333 }); 540 // CHECK-LABEL: @test_int1_custom() 541 // CHECK: %custom = alloca [1 x i32], align 542 // CHECK-NEXT: bitcast 543 // CHECK-NEXT: call void @llvm.memcpy 544 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 545 546 TEST_UNINIT(int64, int[64]); 547 // CHECK-LABEL: @test_int64_uninit() 548 // CHECK: %uninit = alloca [64 x i32], align 549 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 550 551 TEST_BRACES(int64, int[64]); 552 // CHECK-LABEL: @test_int64_braces() 553 // CHECK: %braces = alloca [64 x i32], align [[ALIGN:[0-9]*]] 554 // CHECK-NEXT: bitcast 555 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 256, i1 false) 556 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 557 558 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 }); 559 // CHECK-LABEL: @test_int64_custom() 560 // CHECK: %custom = alloca [64 x i32], align [[ALIGN:[0-9]*]] 561 // CHECK-NEXT: bitcast 562 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 17, i64 256, i1 false) 563 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 564 565 TEST_UNINIT(bool4, bool[4]); 566 // CHECK-LABEL: @test_bool4_uninit() 567 // CHECK: %uninit = alloca [4 x i8], align 568 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 569 570 TEST_BRACES(bool4, bool[4]); 571 // CHECK-LABEL: @test_bool4_braces() 572 // CHECK: %braces = alloca [4 x i8], align [[ALIGN:[0-9]*]] 573 // CHECK-NEXT: bitcast 574 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 575 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 576 577 TEST_CUSTOM(bool4, bool[4], { true, true, true, true }); 578 // CHECK-LABEL: @test_bool4_custom() 579 // CHECK: %custom = alloca [4 x i8], align 580 // CHECK-NEXT: bitcast 581 // CHECK-NEXT: call void @llvm.memcpy 582 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 583 584 TEST_UNINIT(intptr4, int*[4]); 585 // CHECK-LABEL: @test_intptr4_uninit() 586 // CHECK: %uninit = alloca [4 x i32*], align 587 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 588 589 TEST_BRACES(intptr4, int*[4]); 590 // CHECK-LABEL: @test_intptr4_braces() 591 // CHECK: %braces = alloca [4 x i32*], align [[ALIGN:[0-9]*]] 592 // CHECK-NEXT: bitcast 593 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 32, i1 false) 594 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 595 596 TEST_CUSTOM(intptr4, int*[4], = { (int*)0x22222222, (int*)0x22222222, (int*)0x22222222, (int*)0x22222222 }); 597 // CHECK-LABEL: @test_intptr4_custom() 598 // CHECK: %custom = alloca [4 x i32*], align 599 // CHECK-NEXT: bitcast 600 // CHECK-NEXT: call void @llvm.memcpy 601 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 602 603 TEST_UNINIT(tailpad4, tailpad[4]); 604 // CHECK-LABEL: @test_tailpad4_uninit() 605 // CHECK: %uninit = alloca [4 x %struct.tailpad], align 606 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 607 608 TEST_BRACES(tailpad4, tailpad[4]); 609 // CHECK-LABEL: @test_tailpad4_braces() 610 // CHECK: %braces = alloca [4 x %struct.tailpad], align [[ALIGN:[0-9]*]] 611 // CHECK-NEXT: bitcast 612 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false) 613 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 614 615 TEST_CUSTOM(tailpad4, tailpad[4], { {257, 1}, {257, 1}, {257, 1}, {257, 1} }); 616 // CHECK-LABEL: @test_tailpad4_custom() 617 // CHECK: %custom = alloca [4 x %struct.tailpad], align 618 // CHECK-NEXT: bitcast 619 // CHECK-NEXT: call void @llvm.memcpy 620 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 621 622 TEST_UNINIT(tailpad9, tailpad[9]); 623 // CHECK-LABEL: @test_tailpad9_uninit() 624 // CHECK: %uninit = alloca [9 x %struct.tailpad], align 625 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 626 627 TEST_BRACES(tailpad9, tailpad[9]); 628 // CHECK-LABEL: @test_tailpad9_braces() 629 // CHECK: %braces = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]] 630 // CHECK-NEXT: bitcast 631 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 36, i1 false) 632 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 633 634 TEST_CUSTOM(tailpad9, tailpad[9], { {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1}, {257, 1} }); 635 // CHECK-LABEL: @test_tailpad9_custom() 636 // CHECK: %custom = alloca [9 x %struct.tailpad], align [[ALIGN:[0-9]*]] 637 // CHECK-NEXT: bitcast 638 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 1, i64 36, i1 false) 639 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 640 641 642 TEST_UNINIT(atomicbool, _Atomic(bool)); 643 // CHECK-LABEL: @test_atomicbool_uninit() 644 // CHECK: %uninit = alloca i8, align 645 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 646 647 TEST_UNINIT(atomicint, _Atomic(int)); 648 // CHECK-LABEL: @test_atomicint_uninit() 649 // CHECK: %uninit = alloca i32, align 650 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 651 652 TEST_UNINIT(atomicdouble, _Atomic(double)); 653 // CHECK-LABEL: @test_atomicdouble_uninit() 654 // CHECK: %uninit = alloca double, align 655 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 656 657 TEST_UNINIT(atomicnotlockfree, _Atomic(notlockfree)); 658 // CHECK-LABEL: @test_atomicnotlockfree_uninit() 659 // CHECK: %uninit = alloca %struct.notlockfree, align 660 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 661 662 TEST_UNINIT(atomicpadded, _Atomic(padded)); 663 // CHECK-LABEL: @test_atomicpadded_uninit() 664 // CHECK: %uninit = alloca %struct.padded, align 665 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 666 667 TEST_UNINIT(atomictailpad, _Atomic(tailpad)); 668 // CHECK-LABEL: @test_atomictailpad_uninit() 669 // CHECK: %uninit = alloca %struct.tailpad, align 670 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 671 672 673 TEST_UNINIT(complexfloat, _Complex float); 674 // CHECK-LABEL: @test_complexfloat_uninit() 675 // CHECK: %uninit = alloca { float, float }, align 676 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 677 678 TEST_BRACES(complexfloat, _Complex float); 679 // CHECK-LABEL: @test_complexfloat_braces() 680 // CHECK: %braces = alloca { float, float }, align [[ALIGN:[0-9]*]] 681 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %braces, i32 0, i32 0 682 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %braces, i32 0, i32 1 683 // CHECK-NEXT: store float 0.000000e+00, float* %[[R]], align [[ALIGN]] 684 // CHECK-NEXT: store float 0.000000e+00, float* %[[I]], align [[ALIGN]] 685 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 686 687 TEST_CUSTOM(complexfloat, _Complex float, { 3.1415926535897932384626433, 3.1415926535897932384626433 }); 688 // CHECK-LABEL: @test_complexfloat_custom() 689 // CHECK: %custom = alloca { float, float }, align [[ALIGN:[0-9]*]] 690 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %custom, i32 0, i32 0 691 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { float, float }, { float, float }* %custom, i32 0, i32 1 692 // CHECK-NEXT: store float 0x400921FB60000000, float* %[[R]], align [[ALIGN]] 693 // CHECK-NEXT: store float 0x400921FB60000000, float* %[[I]], align [[ALIGN]] 694 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 695 696 TEST_UNINIT(complexdouble, _Complex double); 697 // CHECK-LABEL: @test_complexdouble_uninit() 698 // CHECK: %uninit = alloca { double, double }, align 699 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 700 701 TEST_BRACES(complexdouble, _Complex double); 702 // CHECK-LABEL: @test_complexdouble_braces() 703 // CHECK: %braces = alloca { double, double }, align [[ALIGN:[0-9]*]] 704 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %braces, i32 0, i32 0 705 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %braces, i32 0, i32 1 706 // CHECK-NEXT: store double 0.000000e+00, double* %[[R]], align [[ALIGN]] 707 // CHECK-NEXT: store double 0.000000e+00, double* %[[I]], align [[ALIGN]] 708 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 709 710 TEST_CUSTOM(complexdouble, _Complex double, { 3.1415926535897932384626433, 3.1415926535897932384626433 }); 711 // CHECK-LABEL: @test_complexdouble_custom() 712 // CHECK: %custom = alloca { double, double }, align [[ALIGN:[0-9]*]] 713 // CHECK-NEXT: %[[R:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %custom, i32 0, i32 0 714 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds { double, double }, { double, double }* %custom, i32 0, i32 1 715 // CHECK-NEXT: store double 0x400921FB54442D18, double* %[[R]], align [[ALIGN]] 716 // CHECK-NEXT: store double 0x400921FB54442D18, double* %[[I]], align [[ALIGN]] 717 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 718 719 720 TEST_UNINIT(volatileint, volatile int); 721 // CHECK-LABEL: @test_volatileint_uninit() 722 // CHECK: %uninit = alloca i32, align 723 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 724 725 TEST_BRACES(volatileint, volatile int); 726 // CHECK-LABEL: @test_volatileint_braces() 727 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 728 // CHECK-NEXT: store volatile i32 0, i32* %braces, align [[ALIGN]] 729 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 730 731 TEST_UNINIT(semivolatile, semivolatile); 732 // CHECK-LABEL: @test_semivolatile_uninit() 733 // CHECK: %uninit = alloca %struct.semivolatile, align 734 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 735 736 TEST_BRACES(semivolatile, semivolatile); 737 // CHECK-LABEL: @test_semivolatile_braces() 738 // CHECK: %braces = alloca %struct.semivolatile, align [[ALIGN:[0-9]*]] 739 // CHECK-NEXT: bitcast 740 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false) 741 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 742 743 TEST_CUSTOM(semivolatile, semivolatile, { 0x44444444, 0x44444444 }); 744 // CHECK-LABEL: @test_semivolatile_custom() 745 // CHECK: %custom = alloca %struct.semivolatile, align 746 // CHECK-NEXT: bitcast 747 // CHECK-NEXT: call void @llvm.memcpy 748 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 749 750 TEST_UNINIT(semivolatileinit, semivolatileinit); 751 // CHECK-LABEL: @test_semivolatileinit_uninit() 752 // CHECK: %uninit = alloca %struct.semivolatileinit, align 753 // CHECK-NEXT: call void @{{.*}}semivolatileinit{{.*}}%uninit) 754 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 755 756 TEST_BRACES(semivolatileinit, semivolatileinit); 757 // CHECK-LABEL: @test_semivolatileinit_braces() 758 // CHECK: %braces = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]] 759 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %braces, i32 0, i32 0 760 // CHECK-NEXT: store i32 286331153, i32* %[[I]], align [[ALIGN]] 761 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %braces, i32 0, i32 1 762 // CHECK-NEXT: store volatile i32 286331153, i32* %[[VI]], align [[ALIGN]] 763 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 764 765 TEST_CUSTOM(semivolatileinit, semivolatileinit, { 0x44444444, 0x44444444 }); 766 // CHECK-LABEL: @test_semivolatileinit_custom() 767 // CHECK: %custom = alloca %struct.semivolatileinit, align [[ALIGN:[0-9]*]] 768 // CHECK-NEXT: %[[I:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %custom, i32 0, i32 0 769 // CHECK-NEXT: store i32 1145324612, i32* %[[I]], align [[ALIGN]] 770 // CHECK-NEXT: %[[VI:[^ ]*]] = getelementptr inbounds %struct.semivolatileinit, %struct.semivolatileinit* %custom, i32 0, i32 1 771 // CHECK-NEXT: store volatile i32 1145324612, i32* %[[VI]], align [[ALIGN]] 772 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 773 774 775 TEST_UNINIT(base, base); 776 // CHECK-LABEL: @test_base_uninit() 777 // CHECK: %uninit = alloca %struct.base, align 778 // CHECK-NEXT: call void @{{.*}}base{{.*}}%uninit) 779 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 780 781 TEST_BRACES(base, base); 782 // CHECK-LABEL: @test_base_braces() 783 // CHECK: %braces = alloca %struct.base, align [[ALIGN:[0-9]*]] 784 // CHECK-NEXT: bitcast 785 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false) 786 // CHECK-NEXT: call void @{{.*}}base{{.*}}%braces) 787 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 788 789 TEST_UNINIT(derived, derived); 790 // CHECK-LABEL: @test_derived_uninit() 791 // CHECK: %uninit = alloca %struct.derived, align 792 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%uninit) 793 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 794 795 TEST_BRACES(derived, derived); 796 // CHECK-LABEL: @test_derived_braces() 797 // CHECK: %braces = alloca %struct.derived, align [[ALIGN:[0-9]*]] 798 // CHECK-NEXT: bitcast 799 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 8, i1 false) 800 // CHECK-NEXT: call void @{{.*}}derived{{.*}}%braces) 801 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 802 803 TEST_UNINIT(virtualderived, virtualderived); 804 // CHECK-LABEL: @test_virtualderived_uninit() 805 // CHECK: %uninit = alloca %struct.virtualderived, align 806 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%uninit) 807 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 808 809 TEST_BRACES(virtualderived, virtualderived); 810 // CHECK-LABEL: @test_virtualderived_braces() 811 // CHECK: %braces = alloca %struct.virtualderived, align [[ALIGN:[0-9]*]] 812 // CHECK-NEXT: bitcast 813 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 16, i1 false) 814 // CHECK-NEXT: call void @{{.*}}virtualderived{{.*}}%braces) 815 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 816 817 818 TEST_UNINIT(matching, matching); 819 // CHECK-LABEL: @test_matching_uninit() 820 // CHECK: %uninit = alloca %union.matching, align 821 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 822 823 TEST_BRACES(matching, matching); 824 // CHECK-LABEL: @test_matching_braces() 825 // CHECK: %braces = alloca %union.matching, align [[ALIGN:[0-9]*]] 826 // CHECK-NEXT: bitcast 827 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 828 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 829 830 TEST_CUSTOM(matching, matching, { .f = 0xf00f }); 831 // CHECK-LABEL: @test_matching_custom() 832 // CHECK: %custom = alloca %union.matching, align 833 // CHECK-NEXT: bitcast 834 // CHECK-NEXT: call void @llvm.memcpy 835 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 836 837 TEST_UNINIT(matchingreverse, matchingreverse); 838 // CHECK-LABEL: @test_matchingreverse_uninit() 839 // CHECK: %uninit = alloca %union.matchingreverse, align 840 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 841 842 TEST_BRACES(matchingreverse, matchingreverse); 843 // CHECK-LABEL: @test_matchingreverse_braces() 844 // CHECK: %braces = alloca %union.matchingreverse, align [[ALIGN:[0-9]*]] 845 // CHECK-NEXT: bitcast 846 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 847 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 848 849 TEST_CUSTOM(matchingreverse, matchingreverse, { .i = 0xf00f }); 850 // CHECK-LABEL: @test_matchingreverse_custom() 851 // CHECK: %custom = alloca %union.matchingreverse, align 852 // CHECK-NEXT: bitcast 853 // CHECK-NEXT: call void @llvm.memcpy 854 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 855 856 TEST_UNINIT(unmatched, unmatched); 857 // CHECK-LABEL: @test_unmatched_uninit() 858 // CHECK: %uninit = alloca %union.unmatched, align 859 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 860 861 TEST_BRACES(unmatched, unmatched); 862 // CHECK-LABEL: @test_unmatched_braces() 863 // CHECK: %braces = alloca %union.unmatched, align 864 // CHECK-NEXT: bitcast 865 // CHECK-NEXT: call void @llvm.memcpy 866 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 867 868 TEST_CUSTOM(unmatched, unmatched, { .i = 0x3badbeef }); 869 // CHECK-LABEL: @test_unmatched_custom() 870 // CHECK: %custom = alloca %union.unmatched, align 871 // CHECK-NEXT: bitcast 872 // CHECK-NEXT: call void @llvm.memcpy 873 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 874 875 TEST_UNINIT(unmatchedreverse, unmatchedreverse); 876 // CHECK-LABEL: @test_unmatchedreverse_uninit() 877 // CHECK: %uninit = alloca %union.unmatchedreverse, align 878 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 879 880 TEST_BRACES(unmatchedreverse, unmatchedreverse); 881 // CHECK-LABEL: @test_unmatchedreverse_braces() 882 // CHECK: %braces = alloca %union.unmatchedreverse, align [[ALIGN:[0-9]*]] 883 // CHECK-NEXT: bitcast 884 // CHECK-NEXT: call void @llvm.memset{{.*}}(i8* align [[ALIGN]] %{{.*}}, i8 0, i64 4, i1 false) 885 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 886 887 TEST_CUSTOM(unmatchedreverse, unmatchedreverse, { .c = 42 }); 888 // CHECK-LABEL: @test_unmatchedreverse_custom() 889 // CHECK: %custom = alloca %union.unmatchedreverse, align 890 // CHECK-NEXT: bitcast 891 // CHECK-NEXT: call void @llvm.memcpy 892 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 893 894 TEST_UNINIT(unmatchedfp, unmatchedfp); 895 // CHECK-LABEL: @test_unmatchedfp_uninit() 896 // CHECK: %uninit = alloca %union.unmatchedfp, align 897 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 898 899 TEST_BRACES(unmatchedfp, unmatchedfp); 900 // CHECK-LABEL: @test_unmatchedfp_braces() 901 // CHECK: %braces = alloca %union.unmatchedfp, align 902 // CHECK-NEXT: bitcast 903 // CHECK-NEXT: call void @llvm.memcpy 904 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 905 906 TEST_CUSTOM(unmatchedfp, unmatchedfp, { .d = 3.1415926535897932384626433 }); 907 // CHECK-LABEL: @test_unmatchedfp_custom() 908 // CHECK: %custom = alloca %union.unmatchedfp, align 909 // CHECK-NEXT: bitcast 910 // CHECK-NEXT: call void @llvm.memcpy 911 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 912 913 914 TEST_UNINIT(emptyenum, emptyenum); 915 // CHECK-LABEL: @test_emptyenum_uninit() 916 // CHECK: %uninit = alloca i32, align 917 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 918 919 TEST_BRACES(emptyenum, emptyenum); 920 // CHECK-LABEL: @test_emptyenum_braces() 921 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 922 // CHECK-NEXT: store i32 0, i32* %braces, align [[ALIGN]] 923 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 924 925 TEST_CUSTOM(emptyenum, emptyenum, { (emptyenum)42 }); 926 // CHECK-LABEL: @test_emptyenum_custom() 927 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]] 928 // CHECK-NEXT: store i32 42, i32* %custom, align [[ALIGN]] 929 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 930 931 TEST_UNINIT(smallenum, smallenum); 932 // CHECK-LABEL: @test_smallenum_uninit() 933 // CHECK: %uninit = alloca i32, align 934 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 935 936 TEST_BRACES(smallenum, smallenum); 937 // CHECK-LABEL: @test_smallenum_braces() 938 // CHECK: %braces = alloca i32, align [[ALIGN:[0-9]*]] 939 // CHECK-NEXT: store i32 0, i32* %braces, align [[ALIGN]] 940 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 941 942 TEST_CUSTOM(smallenum, smallenum, { (smallenum)42 }); 943 // CHECK-LABEL: @test_smallenum_custom() 944 // CHECK: %custom = alloca i32, align [[ALIGN:[0-9]*]] 945 // CHECK-NEXT: store i32 42, i32* %custom, align [[ALIGN]] 946 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 947 948 949 TEST_UNINIT(intvec16, int __attribute__((vector_size(16)))); 950 // CHECK-LABEL: @test_intvec16_uninit() 951 // CHECK: %uninit = alloca <4 x i32>, align 952 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 953 954 TEST_BRACES(intvec16, int __attribute__((vector_size(16)))); 955 // CHECK-LABEL: @test_intvec16_braces() 956 // CHECK: %braces = alloca <4 x i32>, align [[ALIGN:[0-9]*]] 957 // CHECK-NEXT: store <4 x i32> zeroinitializer, <4 x i32>* %braces, align [[ALIGN]] 958 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 959 960 TEST_CUSTOM(intvec16, int __attribute__((vector_size(16))), { 0x44444444, 0x44444444, 0x44444444, 0x44444444 }); 961 // CHECK-LABEL: @test_intvec16_custom() 962 // CHECK: %custom = alloca <4 x i32>, align [[ALIGN:[0-9]*]] 963 // CHECK-NEXT: store <4 x i32> <i32 1145324612, i32 1145324612, i32 1145324612, i32 1145324612>, <4 x i32>* %custom, align [[ALIGN]] 964 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 965 966 TEST_UNINIT(longlongvec32, long long __attribute__((vector_size(32)))); 967 // CHECK-LABEL: @test_longlongvec32_uninit() 968 // CHECK: %uninit = alloca <4 x i64>, align 969 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 970 971 TEST_BRACES(longlongvec32, long long __attribute__((vector_size(32)))); 972 // CHECK-LABEL: @test_longlongvec32_braces() 973 // CHECK: %braces = alloca <4 x i64>, align [[ALIGN:[0-9]*]] 974 // CHECK-NEXT: store <4 x i64> zeroinitializer, <4 x i64>* %braces, align [[ALIGN]] 975 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 976 977 TEST_CUSTOM(longlongvec32, long long __attribute__((vector_size(32))), { 0x3333333333333333, 0x3333333333333333, 0x3333333333333333, 0x3333333333333333 }); 978 // CHECK-LABEL: @test_longlongvec32_custom() 979 // CHECK: %custom = alloca <4 x i64>, align [[ALIGN:[0-9]*]] 980 // CHECK-NEXT: store <4 x i64> <i64 3689348814741910323, i64 3689348814741910323, i64 3689348814741910323, i64 3689348814741910323>, <4 x i64>* %custom, align [[ALIGN]] 981 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 982 983 TEST_UNINIT(floatvec16, float __attribute__((vector_size(16)))); 984 // CHECK-LABEL: @test_floatvec16_uninit() 985 // CHECK: %uninit = alloca <4 x float>, align 986 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 987 988 TEST_BRACES(floatvec16, float __attribute__((vector_size(16)))); 989 // CHECK-LABEL: @test_floatvec16_braces() 990 // CHECK: %braces = alloca <4 x float>, align [[ALIGN:[0-9]*]] 991 // CHECK-NEXT: store <4 x float> zeroinitializer, <4 x float>* %braces, align [[ALIGN]] 992 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 993 994 TEST_CUSTOM(floatvec16, float __attribute__((vector_size(16))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 }); 995 // CHECK-LABEL: @test_floatvec16_custom() 996 // CHECK: %custom = alloca <4 x float>, align [[ALIGN:[0-9]*]] 997 // CHECK-NEXT: store <4 x float> <float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000, float 0x400921FB60000000>, <4 x float>* %custom, align [[ALIGN]] 998 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 999 1000 TEST_UNINIT(doublevec32, double __attribute__((vector_size(32)))); 1001 // CHECK-LABEL: @test_doublevec32_uninit() 1002 // CHECK: %uninit = alloca <4 x double>, align 1003 // CHECK-NEXT: call void @{{.*}}used{{.*}}%uninit) 1004 1005 TEST_BRACES(doublevec32, double __attribute__((vector_size(32)))); 1006 // CHECK-LABEL: @test_doublevec32_braces() 1007 // CHECK: %braces = alloca <4 x double>, align [[ALIGN:[0-9]*]] 1008 // CHECK-NEXT: store <4 x double> zeroinitializer, <4 x double>* %braces, align [[ALIGN]] 1009 // CHECK-NEXT: call void @{{.*}}used{{.*}}%braces) 1010 1011 TEST_CUSTOM(doublevec32, double __attribute__((vector_size(32))), { 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433, 3.1415926535897932384626433 }); 1012 // CHECK-LABEL: @test_doublevec32_custom() 1013 // CHECK: %custom = alloca <4 x double>, align [[ALIGN:[0-9]*]] 1014 // CHECK-NEXT: store <4 x double> <double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18, double 0x400921FB54442D18>, <4 x double>* %custom, align [[ALIGN]] 1015 // CHECK-NEXT: call void @{{.*}}used{{.*}}%custom) 1016 1017 1018 } // extern "C" 1019