[PATCH] D58634: [PR40778] Generate address space conversion when binding reference to a temporary value in different address space
John McCall via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 25 21:42:45 PST 2019
rjmccall added inline comments.
================
Comment at: lib/CodeGen/CGCall.cpp:4067
+ IRFuncTy->getParamType(FirstIRArg)->isPointerTy())
+ V = Builder.CreatePointerBitCastOrAddrSpaceCast(
+ V, IRFuncTy->getParamType(FirstIRArg));
----------------
Anastasia wrote:
> 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.
We want to allow language address spaces to be arbitrarily mapped to IR address spaces during lowering, which might include e.g. changing the null value. That's why we pass language address spaces down.
You should be getting the language address space from the appropriate type. I wouldn't expect that to include address-space conversions at this point, though; is there maybe a missing implicit conversions somewhere?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D58634/new/
https://reviews.llvm.org/D58634
More information about the cfe-commits
mailing list