[llvm] [llubi] Add support for constant inttoptr/ptrtoint expressions (PR #207028)
Ralf Jung via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 07:11:20 PDT 2026
RalfJung wrote:
Sorry for the slow response, I had a big deadline in $job so fell behind on notifications.
I agree that ptrtoint in a const expression makes no sense at all. That operation has a side-effect (exposing the provenance), which isn't valid for a const expression. ptrtoaddr might make sense as a const expression though it is tricky since the actual address isn't known at compile time... but then I don't know much about const expressions in LLVM so maybe that is not a problem.
inttoptr is "fine" is the sense that the resulting pointer will have a provenance that can only access allocations that are "pre-exposed at program startup" (e.g. memory regions set up at fixed addresses by the hardware or loader).
> This patch treats constant inttoptr/ptrtoint expressions as if they are executed just before the user.
So llubi already has support for inttoptr/ptrtoint in regular code? How do those behave? That's the much more interesting question IMO.^^
https://github.com/llvm/llvm-project/pull/207028
More information about the llvm-commits
mailing list