[llvm] [InferAddressSpaces] apply InferAddressSpaces to inttoptr-zext-ptrtoint address expression. (PR #79108)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 21 00:14:04 PDT 2024
yujc9 wrote:
> Can you elaborate more on what the use case where you need this form of reinterpret is?
>
> I'm still nervous about touching inttoptr. alive2 will only help you so much to prove this is correct (e.g. you have to strip out the non-0 address spaces, https://alive2.llvm.org/ce/z/QxFvQe, which gives a not reassuring it couldn't prove it's correct)
Sorry for the late reply. As alive2 shown, doing inttoptr - zext - ptrtoint conversion on a same address space (here 0) is meaningless and causes UB. The case shown in alive2 is weird because %tmp2 is 32bit, but `%tmp2 = inttoptr i64 %tmp1 to ptr` treats it as 64bit. `zext` is needed when the source address space is 32bit while the target address space is 64bit for instance.
https://github.com/llvm/llvm-project/pull/79108
More information about the llvm-commits
mailing list