[IndVars] Provide eliminateIVComparison with context
authorMax Kazantsev <mkazantsev@azul.com>
Fri, 19 Mar 2021 05:00:06 +0000 (12:00 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Fri, 19 Mar 2021 05:28:22 +0000 (12:28 +0700)
commit16370e02a715717dd585537f02eb3e3a3221637e
tree7c5accf55a698b3af64ff27ac5a823ba26488cd1
parentfc1812a0ad757838b66aab57e1df720ec205a16a
[IndVars] Provide eliminateIVComparison with context

We can prove more predicates when we have a context when eliminating ICmp.
As first (and very obvious) approximation we can use the ICmp instruction itself,
though in the future we are going to use a common dominator of all its users.
Need some refactoring before that.

Observed ~0.5% negative compile time impact.

Differential Revision: https://reviews.llvm.org/D98697
Reviewed By: lebedev.ri
llvm/lib/Transforms/Utils/SimplifyIndVar.cpp
llvm/test/Transforms/IndVarSimplify/X86/pr35406.ll
llvm/test/Transforms/IndVarSimplify/checks_against_min_value.ll
llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll
llvm/test/Transforms/LoopLoadElim/pr-49141.ll