[llvm-branch-commits] [llvm] [IR] Introduce the `ptrtoaddr` instruction (PR #139357)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jul 23 02:13:15 PDT 2025


nikic wrote:

> If we're going to add this, it would be good to add the other one of the pair—the set-address instruction—at the same time.
> 
> The Rust strict provenance model (and, hopefully, C++29) and CHERI both have these as parts of the provenance model: an instruction / function that takes a pointer and an address and propagate the provenance from the pointer but not the address. This makes provenance-based alias analysis simpler, but just adding one of these two operations in isolation doesn't give that benefit.

The set address operation can already be encoded by `ptradd(p, new_addr - ptrtoaddr(p))`. I doubt we're going to add an instruction for that. We might add an intrinsic. But I don't think think this needs to be coupled to the ptrtoaddr introduction.

https://github.com/llvm/llvm-project/pull/139357


More information about the llvm-branch-commits mailing list