yaxunl marked 2 inline comments as done.
yaxunl added inline comments.

================
Comment at: lib/CodeGen/CGDecl.cpp:1115
+  assert(T.getAddressSpace() == LangAS::Default ||
+         T.getQualifiers().hasTargetSpecificAddressSpace());
+  auto Addr = getTargetHooks().performAddrSpaceCast(*this,
----------------
t-tye wrote:
> Should allowing specifying an address space on a function local automatic 
> variable in OpenCL be allowed? It seems generating LLVM IR that allocates the 
> variable in the alloca address space then address space casting the pointer 
> to some other address space is not what such a language feature is requesting.
> 
> It seems it is really requesting that the variable is allocated in a 
> different address space. That could be indicated by putting a different 
> address space on the alloca itself, but the builder only allows an alloca to 
> use the default alloca address space. No target supports this ability.
> 
> So maybe the best solution is to make OpenCL be the same as C and not allow 
> an address space qualifier on function scope automatic variables.
> 
> If that is done then this assert will only allow the language default address 
> space.
Agree. I think that is why C++ forbids `__attribute__((address_space(n))` on 
automatic variables. I will make it apply to all languages.


https://reviews.llvm.org/D32248



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to