[llvm-dev] [RFC] Add CastInst::CreateBitOrPointerOrAddrSpaceCast

Liu, Yaxun (Sam) via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 29 08:53:46 PDT 2016


Currently there is

CastInst::CreateBitOrPointerCast

which accepts src and target as pointer or non-pointer arguments, but will assert if src and target are both pointers but having different address space.

And there is

CastInst::CreatePointerBitCastOrAddrSpaceCast

Which only accepts pointer arguments and allows src and target have different address space.

So if I want to use CastInst::CreateBitOrPointerCast but my target and src may be pointers of different address space, I have to do it like this:

If src and target are pointers)
  call  CreatePointerBitCastOrAddrSpaceCast
else
  call CreateBitOrPointerCast

It seems to be a common task. I am wondering if it is a good idea to add CastInst::CreateBitOrPointerOrAddrSpaceCast which does the above, or modify CreateBitOrPointerCast to incorporate the above logic.

Thanks.

Sam


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20160929/8a752b2a/attachment.html>


More information about the llvm-dev mailing list