[PATCH] D26196: AMDGPU: Translate null pointers in private and local addr space
Yaxun Liu via cfe-commits
cfe-commits at lists.llvm.org
Tue Nov 1 09:15:39 PDT 2016
yaxunl created this revision.
yaxunl added reviewers: arsenm, tstellarAMD, rjmccall.
yaxunl added a subscriber: cfe-commits.
Herald added subscribers: tony-tye, nhaehnle, wdng, kzhuravl.
In amdgcn target, null pointers in global, constant, and generic address space take value 0 but null pointers in private and local address space take value -1. Currently LLVM assumes all null pointers take value 0, which results in incorrectly translated IR. To workaround this issue, instead of emit null pointers in local and private address space, a null pointer in generic address space is emitted and casted to local and private address space.
A virtual member function translateNullPtr is added to TargetCodeGenInfo which by default does nothing. Each target can override this virtual function for translating null pointers.
A wrapper function translateNullPtr is added to CodegenModule to facilitate performing the target specific translation of null pointers.
This change has no effect on other targets except amdgcn target.
https://reviews.llvm.org/D26196
Files:
lib/CodeGen/CGExprConstant.cpp
lib/CodeGen/CGExprScalar.cpp
lib/CodeGen/CodeGenModule.h
lib/CodeGen/TargetInfo.cpp
lib/CodeGen/TargetInfo.h
test/CodeGenOpenCL/amdgpu-nullptr.cl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26196.76572.patch
Type: text/x-patch
Size: 6495 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161101/c3e11c79/attachment.bin>
More information about the cfe-commits
mailing list