[PATCH] D31404: [OpenCL] Allow alloca return non-zero private pointer

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 27 12:19:13 PDT 2017


yaxunl created this revision.
Herald added subscribers: nhaehnle, wdng.

There is an incoming change in LLVM allowing alloca to return a private pointer which does not pointing to address space 0:

https://reviews.llvm.org/D31042#03b9d490

After this change is committed, alloca will return a pointer pointing to an address space specified by the data layout (so called alloca addr space, which is the last component of the data layout, e.g. A5 indicating alloca address space is 5). A data layout not specifying alloca address space will assume it is 0, therefore keeping the original behaviour.

Clang codegen needs to make corresponding changes to account for the API change of alloca. The change is straightforward. Basically when creating alloca, use the alloca address space specified by the data layout.

For OpenCL, the private address space qualifier is 0 in AST. Before this change, 0 address space qualifier is always mapped to target address space 0. As now target private address space is specified by alloca address space in data layout, address space qualifier 0 needs to be mapped to alloca addr space specified by the data layout.

This change has no impact on targets whose alloca addr space is 0.


https://reviews.llvm.org/D31404

Files:
  include/clang/AST/ASTContext.h
  lib/AST/ASTContext.cpp
  lib/Basic/Targets.cpp
  lib/CodeGen/CGBuiltin.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CGObjCGNU.cpp
  test/CodeGenOpenCL/address-spaces.cl
  test/CodeGenOpenCL/amdgpu-env-amdgiz.cl
  test/CodeGenOpenCL/vla.cl

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31404.93164.patch
Type: text/x-patch
Size: 10748 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170327/5c35e93e/attachment.bin>


More information about the cfe-commits mailing list