[clang] [clang] add array bounds constraints using undef for out-of-bounds access (PR #159046)
Sebastian Pop via cfe-commits
cfe-commits at lists.llvm.org
Thu Sep 18 02:26:22 PDT 2025
sebpop wrote:
> I suspect we want to do something with llvm.assume, or something like that, not use a select.
No.
`assume` is used as "optimization hint".
`undef` is used as "semantic undefined load".
See https://llvm.org/docs/UndefinedBehavior.html#undef-values
> Undef values are deprecated and should be used only when strictly necessary. Uses of undef values should be restricted to representing loads of uninitialized memory. This is the only part of the IR semantics that cannot be replaced with alternatives yet (work in ongoing).
ISEL discards `undef` and `assume`, which brings the code to the back-ends with no `select`, see llc pipeline in https://godbolt.org/z/MPdz4qYvW
https://github.com/llvm/llvm-project/pull/159046
More information about the cfe-commits
mailing list