[SCEV] Fix incorrect NUW inference (#70521)
commit1344b65c90507e2368a3d0678df9f179e8890665
authorDaniil Suchkov <suc-daniil@yandex.ru>
Tue, 31 Oct 2023 18:43:57 +0000 (31 11:43 -0700)
committerGitHub <noreply@github.com>
Tue, 31 Oct 2023 18:43:57 +0000 (31 11:43 -0700)
treef5b59d527cf0a3fa897a855e2d1ea7030744ed94
parentf706411f71a29bc8bb6c04b21958fa3a0d17fd99
[SCEV] Fix incorrect NUW inference (#70521)

This patch fixes a miscompile in LSR caused by incorrect inference of
NUW flag for AddRec: we shouldn't infer no-wrap flags based on a
comparison which doesn't fully control the loop exit.
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Transforms/LoopStrengthReduce/scev-incorrect-nuw-inference.ll