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