// RUN: %clang_cc1 -no-opaque-pointers -triple x86_64 -emit-llvm -o - %s | opt -S -strip -o %t
// RUN: FileCheck --check-prefix=CHECK-GLOBAL < %t %s
// RUN: FileCheck --check-prefix=CHECK-FUNCTIONS < %t %s
;
// CHECK-GLOBAL: @s0_align_x ={{.*}} global i32 4
// CHECK-GLOBAL: @s0_align_y ={{.*}} global i32 1
// CHECK-GLOBAL: @s0_align ={{.*}} global i32 4
int s0_align_x = ;
int s0_align_y = ;
int s0_align = ;
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s0_load_x
// CHECK-FUNCTIONS: [[s0_load_x:%.*]] = load i32, i32* {{.*}}, align 4
// CHECK-FUNCTIONS: ret i32 [[s0_load_x]]
int
// FIXME: This seems like it should be align 1. This is actually something which
// has changed in llvm-gcc recently, previously both x and y would be loaded
// with align 1 (in 2363.1 at least).
//
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s0_load_y
// CHECK-FUNCTIONS: [[s0_load_y:%.*]] = load i32, i32* {{.*}}, align 4
// CHECK-FUNCTIONS: ret i32 [[s0_load_y]]
int
// CHECK-FUNCTIONS-LABEL: define{{.*}} void @s0_copy
// CHECK-FUNCTIONS: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 4 {{.*}}, i8* align 4 {{.*}}, i64 8, i1 false)
void
//
;
// CHECK-GLOBAL: @s1_align_x ={{.*}} global i32 1
// CHECK-GLOBAL: @s1_align_y ={{.*}} global i32 1
// CHECK-GLOBAL: @s1_align ={{.*}} global i32 1
int s1_align_x = ;
int s1_align_y = ;
int s1_align = ;
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s1_load_x
// CHECK-FUNCTIONS: [[s1_load_x:%.*]] = load i32, i32* {{.*}}, align 1
// CHECK-FUNCTIONS: ret i32 [[s1_load_x]]
int
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s1_load_y
// CHECK-FUNCTIONS: [[s1_load_y:%.*]] = load i32, i32* {{.*}}, align 1
// CHECK-FUNCTIONS: ret i32 [[s1_load_y]]
int
// CHECK-FUNCTIONS-LABEL: define{{.*}} void @s1_copy
// CHECK-FUNCTIONS: call void @llvm.memcpy.p0i8.p0i8.i64(i8* {{.*}}, i8* {{.*}}, i64 8, i1 false)
void
//
;
// CHECK-GLOBAL: @s2_align_x ={{.*}} global i32 2
// CHECK-GLOBAL: @s2_align_y ={{.*}} global i32 2
// CHECK-GLOBAL: @s2_align ={{.*}} global i32 2
int s2_align_x = ;
int s2_align_y = ;
int s2_align = ;
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s2_load_x
// CHECK-FUNCTIONS: [[s2_load_y:%.*]] = load i32, i32* {{.*}}, align 2
// CHECK-FUNCTIONS: ret i32 [[s2_load_y]]
int
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @s2_load_y
// CHECK-FUNCTIONS: [[s2_load_y:%.*]] = load i32, i32* {{.*}}, align 2
// CHECK-FUNCTIONS: ret i32 [[s2_load_y]]
int
// CHECK-FUNCTIONS-LABEL: define{{.*}} void @s2_copy
// CHECK-FUNCTIONS: call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 2 {{.*}}, i8* align 2 {{.*}}, i64 8, i1 false)
void
;
// CHECK-GLOBAL: @s3_1 ={{.*}} global i32 1
int s3_1 = ;
// CHECK-FUNCTIONS-LABEL: define{{.*}} i32 @test3(
int