[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount
authorMax Kazantsev <mkazantsev@azul.com>
Mon, 12 Dec 2022 08:21:33 +0000 (15:21 +0700)
committerMax Kazantsev <mkazantsev@azul.com>
Mon, 12 Dec 2022 09:28:04 +0000 (16:28 +0700)
commitcb06b6ab0018d9aa07bf9fec0052a9f8c921a593
tree06f3768883da0c3fa61ce7adc75c0bf6f5da24b1
parent3bfba672afd52dfd5bde54dc8b67ec96275f9e15
[IndVars][NFC] Remove redundant param in optimizeLoopExitWithUnknownExitCount

There was a crippled version of this transform for Inverted predicate, so the same
query was done twice. Advanced version of this transform wasn't implemented for
inverted condition. Thus, the code was hard to read. The only real purpose of the
Inverted param was to make a simple isKnownPredicateAt query.

Instead if this, use evaluatePredicateAt to solve the task for both inverted and
non-inverted predicate. This slightly changes the order of queries, but effectively
it should save some time by avoiding duplicating queries, and simplifies the code a lot.

I also could not find any evidence that we ever eliminate anything with Inverted = true,
but conservatively preserved the current behavior. Maybe we can remove it and save
some compile time.

Differential Revision: https://reviews.llvm.org/D139814
Reviewed By: nikic
llvm/lib/Transforms/Scalar/IndVarSimplify.cpp