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



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

Reply via email to