[PATCH] D33842: [AMDGPU] Fix address space of global variable
Yaxun Liu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 20 11:51:51 PDT 2017
yaxunl marked 3 inline comments as done.
yaxunl added inline comments.
================
Comment at: include/clang/Basic/TargetInfo.h:959
+ /// \brief Return the target address space which is read only and can be
+ /// casted to the generic address space.
+ virtual llvm::Optional<unsigned> getTargetConstantAddressSpace() const {
----------------
rjmccall wrote:
> "Return an AST address space which can be used opportunistically for constant global memory. It must be possible to convert pointers into this address space to LangAS::Default. If no such address space exists, this may return None, and such optimizations will be disabled."
I will change it. Also I think getConstantAddressSpace may be a better name since we will return AST addr space.
================
Comment at: lib/CodeGen/CGExpr.cpp:449
+ Var, ConvertTypeForMem(E->getType())->getPointerTo()),
Object.getAlignment());
// If the temporary is a global and has a constant initializer or is a
----------------
rjmccall wrote:
> Every time you're tempted to use getPointerCast, you should instead be using the target hook to lift the pointer into the right address space.
I am going to fix it. However this seems not the right place to do the addr space cast. I am going to do it in createReferenceTemporary instead.
https://reviews.llvm.org/D33842
More information about the cfe-commits
mailing list