[llvm] [SCEV] Try to prove no-wrap for AddRecs via BTC. (PR #131538)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 4 06:53:00 PDT 2025
https://github.com/fhahn commented:
> Looking at the test diffs, it seems like the case where this helps in practice is if we have a -1 max const btc.
>
> I feel like this case should really be handled by something more fundamental. The proveNoWrapViaConstantRanges() logic doesn't catch this because it checks whether adding the step to the range will not overflow -- in this case the range is full, but the code doesn't know that it won't actually wrap. Of course, the code that actually calculated that range (getRangeForAffineAR) _does_ know that, but we lose the distinction between a full range because the addrec can hit all values and a full range because the calculation overflowed...
Yeah that's right. I tried to differentiate the cases by trying to evaluate the AddRec in a one-bit wider type: https://github.com/llvm/llvm-project/pull/151966
Not sure if I missed anything there
https://github.com/llvm/llvm-project/pull/131538
More information about the llvm-commits
mailing list