[llvm] IR: Simplify BlockAddress replacement (PR #135360)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 11 05:53:22 PDT 2025
nikic wrote:
@arsenm See https://llvm.org/docs/LangRef.html#addresses-of-basic-blocks:
> This value only has defined behavior when used as an operand to the ‘[indirectbr](https://llvm.org/docs/LangRef.html#i-indirectbr)’ or for comparisons against null. Pointer equality tests between labels addresses results in undefined behavior — though, again, comparison against null is ok, and no label is equal to the null pointer. This may be passed around as an opaque pointer sized value as long as the bits are not inspected. This allows ptrtoint and arithmetic to be performed on these values so long as the original value is reconstituted before the indirectbr instruction.
If a block is deleted, we still must guarantee that the corresponding blockaddress compares as non-null.
https://github.com/llvm/llvm-project/pull/135360
More information about the llvm-commits
mailing list