[llvm] LAA: don't speculate stride when BTC >= 0 (PR #96927)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 27 13:21:58 PDT 2024
artagnon wrote:
> > Speculating the stride currently inserts a Stride == 1 predicate, which is equivalent to asserting that the that the loop executes atleast once.
>
> Uh, how are these equivalent (or even related at all)?
We currently speculate on the stride and insert `Stride == 1` when `Stride >= TC`. My understanding is that this is to guard against loops with unknown TC that never execute. Inserting `Stride == 1` is a way to version the loop, so that one version executes with this predicate.
> > However, when the backedge-taken-count is known-non-negative, speculating the stride unnecessarily versions the loop. Avoid this.
>
> The BE count is an unsigned quantity, so I don't get how "known-non-negative" can be meaningful for it.
Wait, what happens for TC = 0? Isn't the BE SCEV an expression that's not known-non-negative?
https://github.com/llvm/llvm-project/pull/96927
More information about the llvm-commits
mailing list