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
18 lines
502 B
Common Lisp
18 lines
502 B
Common Lisp
// RUN: %clang_cc1 -O0 %s -ffake-address-space-map -emit-llvm -o - -fblocks -triple x86_64-unknown-unknown | FileCheck %s
|
|
// This used to crash due to trying to generate a bitcase from a cstring
|
|
// in the constant address space to i8* in AS0.
|
|
|
|
void dummy(float (^const op)(float)) {
|
|
}
|
|
|
|
// CHECK: i8 addrspace(2)* getelementptr inbounds ([9 x i8], [9 x i8] addrspace(2)* @.str, i32 0, i32 0)
|
|
|
|
kernel void test_block()
|
|
{
|
|
float (^const X)(float) = ^(float x) {
|
|
return x + 42.0f;
|
|
};
|
|
dummy(X);
|
|
}
|
|
|