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