CodeGen: Cast alloca to expected address space
authorYaxun Liu <Yaxun.Liu@amd.com>
Thu, 18 May 2017 18:51:09 +0000 (18:51 +0000)
committerYaxun Liu <Yaxun.Liu@amd.com>
Thu, 18 May 2017 18:51:09 +0000 (18:51 +0000)
commit6d96f163476be00b36a9acf0d5abe1ac0136e12f
treee2c369d3a0e3bbefc85bc981d62707f91b9abb26
parentb00ffd8cb7a0f5fd51c9968e4f59b4b3eca52e47
CodeGen: Cast alloca to expected address space

Alloca always returns a pointer in alloca address space, which may
be different from the type defined by the language. For example,
in C++ the auto variables are in the default address space. Therefore
cast alloca to the expected address space when necessary.

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

llvm-svn: 303370
28 files changed:
clang/include/clang/AST/ASTContext.h
clang/include/clang/AST/Type.h
clang/include/clang/Basic/AddressSpaces.h
clang/include/clang/Basic/DiagnosticSemaKinds.td
clang/lib/AST/ASTContext.cpp
clang/lib/AST/TypePrinter.cpp
clang/lib/Basic/Targets.cpp
clang/lib/CodeGen/CGDecl.cpp
clang/lib/CodeGen/CGExprScalar.cpp
clang/lib/CodeGen/CodeGenModule.cpp
clang/lib/CodeGen/CodeGenTypeCache.h
clang/lib/CodeGen/TargetInfo.cpp
clang/lib/CodeGen/TargetInfo.h
clang/lib/Sema/SemaDecl.cpp
clang/lib/Sema/SemaType.cpp
clang/test/CodeGen/address-space.c
clang/test/CodeGenCXX/amdgcn-automatic-variable.cpp [new file with mode: 0644]
clang/test/CodeGenOpenCL/amdgcn-automatic-variable.cl [new file with mode: 0644]
clang/test/CodeGenOpenCL/amdgpu-alignment.cl
clang/test/CodeGenOpenCL/amdgpu-debug-info-pointer-address-space.cl
clang/test/CodeGenOpenCL/amdgpu-debug-info-variable-expression.cl
clang/test/CodeGenOpenCL/amdgpu-nullptr.cl
clang/test/CodeGenOpenCL/builtins-amdgcn.cl
clang/test/CodeGenOpenCL/byval.cl
clang/test/CodeGenOpenCL/size_t.cl
clang/test/Sema/sizeof-struct-non-zero-as-member.cl
clang/test/SemaOpenCL/storageclass-cl20.cl
clang/test/SemaOpenCL/storageclass.cl