Chris Lattner | ffcd06ea | 2009-12-05 06:49:57 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -emit-llvm < %s | FileCheck %s |
| 2 | |
| 3 | // CHECK: @test1.x = internal constant [12 x i32] [i32 1 |
Chris Lattner | e99c110 | 2009-12-05 08:22:11 +0000 | [diff] [blame^] | 4 | // CHECK: @test2.x = internal constant [13 x i32] [i32 1, |
| 5 | |
| 6 | #include <string.h> |
Chris Lattner | ffcd06ea | 2009-12-05 06:49:57 +0000 | [diff] [blame] | 7 | |
| 8 | void test1() { |
| 9 | // This should codegen as a "@test1.x" global. |
| 10 | const int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23 }; |
| 11 | foo(x); |
| 12 | |
| 13 | // CHECK: @test1() |
| 14 | // CHECK: {{call.*@foo.*@test1.x}} |
| 15 | } |
Chris Lattner | e99c110 | 2009-12-05 08:22:11 +0000 | [diff] [blame^] | 16 | |
| 17 | |
| 18 | // rdar://7346691 |
| 19 | void test2() { |
| 20 | // This should codegen as a "@test2.x" global + memcpy. |
| 21 | int x[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 }; |
| 22 | foo(x); |
| 23 | |
| 24 | // CHECK: @test2() |
| 25 | // CHECK: %x = alloca [13 x i32] |
| 26 | // CHECK: call void @llvm.memcpy |
| 27 | // CHECK: call{{.*}}@foo{{.*}}i32* % |
| 28 | } |
| 29 | |
| 30 | |
| 31 | void test3() { |
| 32 | // This should codegen as a "@test3.x" global + memcpy. |
| 33 | int x[100] = { 0 }; |
| 34 | foo(x); |
| 35 | |
| 36 | // CHECK: @test3() |
| 37 | // CHECK: %x = alloca [100 x i32] |
| 38 | // CHECK: call void @llvm.memset |
| 39 | } |
| 40 | |