[PATCH] D33842: [AMDGPU] Fix address space of global variable
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jun 2 11:28:27 PDT 2017
rjmccall added inline comments.
================
Comment at: lib/CodeGen/CGExpr.cpp:360
+ CGF.getContext().getTargetAddressSpace(LangAS::opencl_constant);
+ }
auto *GV = new llvm::GlobalVariable(
----------------
This is not an appropriate place to stick target-specific code. You should add a target hook that returns the address space into which to allocate constant temporaries, with the requirement that the target must not return an address space which cannot be lifted into LangAS::Default. For some configurations this may not be possible (e.g. OpenCL C++?), so the hook should return an Optional<unsigned> so that a None return will disable the optimization.
And you should go ahead and lift the pointer here if necessary.
You may have to make createReferenceTemporary return whether it constant-emitted the temporary initializer.
https://reviews.llvm.org/D33842
More information about the cfe-commits
mailing list