[PATCH] D33706: [AMDGPU] Fix address space for global and temporary variables in C++

Yaxun Liu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 30 18:41:41 PDT 2017


yaxunl created this revision.
Herald added subscribers: t-tye, Anastasia, tpr, dstuttard, wdng, kzhuravl.

AMDGPU backend requires global variables in global or constant address space and alloca in private address space. However, in C++ all variables are in default address space. Previously change has been made to cast automatic variables to default address space. However that is not sufficient since all temporary variables need to be casted to default address space.

This patch casts all temporary variables to default address space except those for passing indirect arguments since they are only used for load/store.

It also puts global variables in global or constant address spaces in a similar approach as CUDA.

It also fixes pointer size and removed OpenCL version metadata for C++ so that backend handles IR properly.

This patch only affects amdgcn target.


https://reviews.llvm.org/D33706

Files:
  lib/Basic/Targets.cpp
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGDecl.cpp
  lib/CodeGen/CGExpr.cpp
  lib/CodeGen/CodeGenFunction.h
  lib/CodeGen/CodeGenModule.cpp
  lib/CodeGen/TargetInfo.cpp
  test/CodeGen/address-space.c
  test/CodeGen/default-address-space.c
  test/CodeGenCXX/amdgcn-automatic-variable.cpp
  test/CodeGenCXX/cxx0x-initializer-stdinitializerlist.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33706.100814.patch
Type: text/x-patch
Size: 39868 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170531/38b78bb3/attachment-0001.bin>


More information about the cfe-commits mailing list