implicit conversion.
The issue was produced with OpenCL C code that
called a function with a constant string literal
argument.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@224592
91177308-0d34-0410-b5e6-
96231b3b80d8
if (!E->getType()->isVariableArrayType()) {
assert(isa<llvm::PointerType>(V->getType()) && "Expected pointer");
V = CGF.Builder.CreatePointerCast(
- V, ConvertType(E->getType())->getPointerTo());
+ V, ConvertType(E->getType())->getPointerTo(
+ V->getType()->getPointerAddressSpace()));
assert(isa<llvm::ArrayType>(V->getType()->getPointerElementType()) &&
"Expected pointer to array");
--- /dev/null
+// RUN: %clang_cc1 %s -emit-llvm -o - -ffake-address-space-map | FileCheck %s
+
+int test_func(constant char* foo);
+
+kernel void str_array_decy() {
+ test_func("Test string literal");
+}
+
+// CHECK: i8 addrspace(3)* getelementptr inbounds ([20 x i8] addrspace(3)*
+// CHECK-NOT: addrspacecast
+