llvm-project/clang/test/CodeGenOpenCL/local-initializer-undef.cl
Egor Churaev 28f00aab73 [OpenCL] Align fake address space map with the SPIR target maps.
Summary:
We compile user opencl kernel code with spir triple. But built-ins are written in OpenCL and we compile it with triple x86_64 to be able to use x86 intrinsics. And we need address spaces to match in both cases. So, we change fake address space map in OpenCL for matching with spir.

On CPU address spaces are not really important but we'd like to preserve address space information in order to perform optimizations relying on this info like enhanced alias analysis.

Reviewers: pekka.jaaskelainen, Anastasia

Subscribers: pekka.jaaskelainen, yaxunl, bader, cfe-commits

Differential Revision: https://reviews.llvm.org/D28048

llvm-svn: 290436
2016-12-23 16:11:25 +00:00

25 lines
711 B
Common Lisp

// RUN: %clang_cc1 %s -O0 -ffake-address-space-map -emit-llvm -o - | FileCheck %s
typedef struct Foo {
int x;
float y;
float z;
} Foo;
// CHECK-DAG: @test.lds_int = internal addrspace(3) global i32 undef
// CHECK-DAG: @test.lds_int_arr = internal addrspace(3) global [128 x i32] undef
// CHECK-DAG: @test.lds_struct = internal addrspace(3) global %struct.Foo undef
// CHECK-DAG: @test.lds_struct_arr = internal addrspace(3) global [64 x %struct.Foo] undef
__kernel void test()
{
__local int lds_int;
__local int lds_int_arr[128];
__local Foo lds_struct;
__local Foo lds_struct_arr[64];
lds_int = 1;
lds_int_arr[0] = 1;
lds_struct.x = 1;
lds_struct_arr[0].x = 1;
}