[SCEV] Fix applyLoopGuards() with range check idiom (PR51760)
authorNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Sep 2021 20:18:11 +0000 (22:18 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 6 Sep 2021 20:22:41 +0000 (22:22 +0200)
commit8d54c8a0c3d7d4a50186ae7087780c6082e5bb46
tree77a4a87091938507a9e407011824e8e01207b1d1
parente1e4bf174b09bcd4b25cd624f177537890bff785
[SCEV] Fix applyLoopGuards() with range check idiom (PR51760)

Due to a typo, this replaced %x with umax(C1, umin(C2, %x + C3))
rather than umax(C1, umin(C2, %x)). This didn't make a difference
for the existing tests, because the result is only used for range
calculation, and %x will usually have an unknown starting range,
and the additional offset keeps it unknown. However, if %x already
has a known range, we may compute a result range that is too
small.
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Analysis/ScalarEvolution/max-backedge-taken-count-guard-info.ll