[llvm] [LAA] Consider unknown SCEVs defined in the loop as IndirectUnsafe. (PR #99239)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 18 14:59:22 PDT 2024
fhahn wrote:
> I think we may need a deeper change here. Consider the case where an index is not a unknown, but some complicated non-affine AddRec (or other complicated computable SCEV expression involving wrapping). Without proving that the expression can't produce the same value twice, don't we have the same basic problem?
>
> Actually, given the reasoning above, wouldn't a simple (urem (%base,+,1), 2) be enough to hit this problem? How do we avoid miscompiling that case? Looking at the generated checks, it looks like we bail if we're not dealing with an AddRec. I do notice that we're not checking for NoSelfWrap which I think we probably need to when computing bounds.
>
> p.s. I'm totally fine with this as a workaround. If you want to land this as a workaround, and then continue the discussion, I'm fine with that.
That's an excellent point, I had a closer look at how we try to detect non-wrapping add-recs and where the current gaps are; I put up https://github.com/llvm/llvm-project/pull/99577 as an alternative which simply refines the checks for strides accesses
https://github.com/llvm/llvm-project/pull/99239
More information about the llvm-commits
mailing list