[PATCH] D58634: [PR40778] Generate address space conversion when binding reference to a temporary value in different address space

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Feb 25 09:51:40 PST 2019

Anastasia marked an inline comment as done.
Anastasia added inline comments.

Comment at: lib/CodeGen/CGCall.cpp:4067
+              IRFuncTy->getParamType(FirstIRArg)->isPointerTy())
+            V = Builder.CreatePointerBitCastOrAddrSpaceCast(
+                V, IRFuncTy->getParamType(FirstIRArg));
We have started using `performAddrSpaceCast` for those but, however, I was very confused about how to get address space of the Clang types correctly here.

I was using this function in a couple of places before but I must admit I am still a bit confused about the purpose of it. Mainly I was wondering if we could drop `LangAS` parameters from it? It would simplify its use a lot in multiple places. As far as I can see they are not used in the function at the moment. I am not sure if they are reserved for some development in the future though?

Altogether I quite like using `IRBuilder` directly because in combination with target address space map it allows to do what's needed here and keep consistent with the rest. Perhaps, I am missing some background info. I have tried to dig out a bit but no much success.



More information about the cfe-commits mailing list