[llvm-branch-commits] [llvm] [SDAG] Introduce inbounds flag for pointer arithmetic (PR #131862)

Eli Friedman via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Thu Mar 20 09:59:59 PDT 2025


efriedma-quic wrote:

> with respect to whatever the address operand is pointing to

Say you have two adjacent objects `a` and `b`.  So `&a+1 == &b`.  If you have an integer `x` such that `x == &a+1 == &b`, which object is `x` pointing to?

In some cases, you might be able to disambiguate based on the RHS of the ptradd; if the offset is positive, it must be inbounds relative to `b`, or else the result would be poison.  Or which object it points to might not matter for certain transforms.

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


More information about the llvm-branch-commits mailing list