1 // RUN: %clang_cc1 -std=c89 -w -fmerge-all-constants -emit-llvm < %s | FileCheck %s
3 // CHECK: @test1.x = internal constant [12 x i32] [i32 1
4 // CHECK: @__const.test2.x = private unnamed_addr constant [13 x i32] [i32 1,
5 // CHECK: @test5w = {{(dso_local )?}}global { i32, [4 x i8] } { i32 2, [4 x i8] undef }
6 // CHECK: @test5y = {{(dso_local )?}}global { double } { double 7.300000e+0{{[0]*}}1 }
8 // CHECK: @__const.test6.x = private unnamed_addr constant %struct.SelectDest { i8 1, i8 2, i32 3, i32 0 }
10 // CHECK: @test7 = {{(dso_local )?}}global [2 x %struct.test7s] [%struct.test7s { i32 1, i32 2 }, %struct.test7s { i32 4, i32 0 }]
13 // This should codegen as a "@test1.x" global.
14 const int x
[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23 };
18 // CHECK: {{call.*@foo.*@test1.x}}
24 // This should codegen as a "@test2.x" global + memcpy.
25 int x
[] = { 1, 2, 3, 4, 6, 8, 9, 10, 123, 231, 123,23, 24 };
29 // CHECK: %x = alloca [13 x i32]
30 // CHECK: call void @llvm.memcpy
31 // CHECK: call{{.*}}@foo{{.*}}ptr noundef %
36 // This should codegen as a memset.
41 // CHECK: %x = alloca [100 x i32]
42 // CHECK: call void @llvm.memset
47 char b
[10] = { "asdf" };
49 // CHECK: %a = alloca [10 x i8]
50 // CHECK: %b = alloca [10 x i8]
51 // CHECK: call void @llvm.memcpy
52 // CHECK: call void @llvm.memcpy
56 union test5u
{ int i
; double d
; };
59 union test5u ola
= (union test5u
) 351;
60 union test5u olb
= (union test5u
) 1.0;
63 union test5u test5w
= (union test5u
)2;
64 union test5u test5y
= (union test5u
)73.0;
68 // PR6660 - sqlite miscompile
71 unsigned char affinity
;
77 struct SelectDest x
= {1, 2, 3};
82 struct test7s
{ int a
; int b
; } test7
[] = {
89 struct test8s
{ int f0
; char f1
; } test8g
= {};
95 void (*x
) (struct S
*);
98 extern struct S
*global_dc
;
99 void cp_diagnostic_starter(struct S
*);
101 void init_error(void) {
102 global_dc
->x
= cp_diagnostic_starter
;
107 // rdar://8147692 - ABI crash in recursive struct-through-function-pointer.
112 typedef struct x2
*x0
;
113 typedef long (*x1
)(x0 x0a
, x5 x6
);
117 long x3(x0 x0a
, x5 a
) {
118 return x0a
->x4(x0a
, a
);