[llvm] [LoopVectorize] Perform loop versioning for some early exit loops (PR #120603)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 4 03:14:47 PST 2026
fhahn wrote:
> Do I understand correctly that this is generating out-of-bounds loads and relying on page granularity to guarantee they don't trap? If so, we cannot perform this transform with normal loads, because it is UB at the IR level -- the behavior of the underlying hardware is irrelevant.
>
> You're going to need a new load intrinsic to support this. I have this RFC draft on the topic lying around: https://hackmd.io/@nikic/S1O4QWYZkx I haven't submitted it, because I'm not particularly happy with the `%defined_size` parameter, which is needed to specify the operational semantics of the intrinsic, but not relevant for lowering.
I took a stab at a definition of a speculative load intrinsic (name subject to change): https://github.com/llvm/llvm-project/pull/179642
Instead of using `%defined_size` , it defines it to load the stored value for bytes in bounds, and undef otherwise. I don't think we could easily compute `%defined_size`, as it would depend on the load values, i.e. which lane would take an early exit.
https://github.com/llvm/llvm-project/pull/120603
More information about the llvm-commits
mailing list