[IndVars] Replace checks with invariants if we cannot remove them
authorMax Kazantsev <mkazantsev@azul.com>
Fri, 13 Nov 2020 05:05:14 +0000 (12:05 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Fri, 13 Nov 2020 05:23:12 +0000 (12:23 +0700)
commit77efb73c672762ce28cfff793db414ce05e3c46a
tree101ff74d1a7c4ad2d7a8c53db279c16e1627180d
parent7602ef768b1af99b6184faf6edfc4e06b718c7c5
[IndVars] Replace checks with invariants if we cannot remove them

If we cannot prove that the check is trivially true, but can prove that it either
fails on the 1st iteration or never fails, we can replace it with first iteration check.

Differential Revision: https://reviews.llvm.org/D88527
Reviewed By: skatkov
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp
llvm/test/Transforms/IndVarSimplify/predicated_ranges.ll