diff options
author | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
---|---|---|
committer | Jordan Rupprecht <rupprecht@google.com> | 2019-05-14 21:58:59 +0000 |
commit | b35a2aa71f76a334a9c98c0a3c3995b5d902d2b9 (patch) | |
tree | cdff4a5d1a715d4ad622fd8f190128b54bebe440 /test/CodeGen/compound-literal.c | |
parent | 3748d41833787fcbf59cc5624e8d2b042a8991bc (diff) | |
parent | 741e05796da92b46d4f7bcbee00702ff37df6489 (diff) |
Creating branches/google/stable and tags/google/stable/2019-05-14 from r360103upstream/google/stable
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/stable@360714 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/compound-literal.c')
-rw-r--r-- | test/CodeGen/compound-literal.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGen/compound-literal.c b/test/CodeGen/compound-literal.c index 38675a7dda..17a24d47f2 100644 --- a/test/CodeGen/compound-literal.c +++ b/test/CodeGen/compound-literal.c @@ -11,6 +11,11 @@ _Complex double * x = &(_Complex double){1.0f}; typedef int v4i32 __attribute((vector_size(16))); v4i32 *y = &(v4i32){1,2,3,4}; +// Check generated code for GNU constant array init from compound literal, +// for a global variable. +// CHECK: @compound_array = global [8 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8] +int compound_array[] = __extension__(__builtin_choose_expr(0, 0, _Generic(1, int: (int[]){1, 2, 3, 4, 5, 6, 7, 8}))); + void xxx() { int* a = &(int){1}; struct s {int a, b, c;} * b = &(struct s) {1, 2, 3}; @@ -82,3 +87,13 @@ int compareMyCLH() { const void *b = MyCLH; return a == b; } + +// Check generated code for GNU constant array init from compound literal, +// for a local variable. +// CHECK-LABEL: define i32 @compound_array_fn() +// CHECK: [[COMPOUND_ARRAY:%.*]] = alloca [8 x i32] +// CHECK: call void @llvm.memcpy.p0i8.p0i8.i64({{.*}}, i64 32, i1 false) +int compound_array_fn() { + int compound_array[] = (int[]){1,2,3,4,5,6,7,8}; + return compound_array[0]; +} |