[LSR] Early exit for RateFormula when it is already losing. NFC
authoreopXD <eop.chen@sifive.com>
Thu, 2 Jun 2022 03:39:38 +0000 (20:39 -0700)
committereopXD <eop.chen@sifive.com>
Thu, 2 Jun 2022 04:02:40 +0000 (21:02 -0700)
commit6eab5cade71459bc187eeeb364b9a94972c05696
tree8fd3e152ecb7e6a0219f6a860920b45a4eb6353f
parentce820375efc04a4290f568ac0ba7a74486f598ad
[LSR] Early exit for RateFormula when it is already losing. NFC

This patch does not effect any behavior of the current code.

The codebase implicitly implies that `Cost::RateFormula` is only called
when the `Cost` is not in losing status, or else there may be possible
to trigger the assertion of `Cost::isValid`.

The intention here is to prevent mis-use where future development
allow `Cost` that is already loser to call `Cost::RateFormula` - Early
exit when `Cost` is already losing.

Reviewed By: Meinersbur, #loopoptwg

Differential Revision: https://reviews.llvm.org/D125670
llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp