blob: b26843132c2fdb257df3965945431d0fd85c7e73 [file] [log] [blame]
Chris Lattnerffcd06ea2009-12-05 06:49:57 +00001// RUN: clang-cc -emit-llvm < %s | FileCheck %s
2
3// CHECK: @test1.x = internal constant [12 x i32] [i32 1
Chris Lattnere99c1102009-12-05 08:22:11 +00004// CHECK: @test2.x = internal constant [13 x i32] [i32 1,
5
6#include <string.h>
Chris Lattnerffcd06ea2009-12-05 06:49:57 +00007
8void 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 Lattnere99c1102009-12-05 08:22:11 +000016
17
18// rdar://7346691
19void 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
31void 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