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