diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-12-03 17:45:47 +0300 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-12-03 20:04:51 +0300 |
commit | 9a20c79ddc2523fb68be4d4246d7835c761c382f (patch) | |
tree | 064eab89c1f5fe78847c52311ad22de67a89b054 /llvm/lib/Support | |
parent | 372ad32734ecb455f9fb4d0601229ca2dfc78b66 (diff) | |
download | bcm5719-llvm-9a20c79ddc2523fb68be4d4246d7835c761c382f.tar.gz bcm5719-llvm-9a20c79ddc2523fb68be4d4246d7835c761c382f.zip |
[NFC][KnownBits] Add getMinValue() / getMaxValue() methods
As it can be seen from accompanying cleanup, it is not unheard of
to write `~Known.Zero` meaning "what maximal value can this KnownBits
produce". But i think `~Known.Zero` isn't *that* self-explanatory,
as compared to a method with a name.
Note that not all `~Known.Zero` places were cleaned up,
only those where this arguably improves things.
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r-- | llvm/lib/Support/KnownBits.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/KnownBits.cpp b/llvm/lib/Support/KnownBits.cpp index a6c591fca31..8f3f4aa8cae 100644 --- a/llvm/lib/Support/KnownBits.cpp +++ b/llvm/lib/Support/KnownBits.cpp @@ -21,8 +21,8 @@ static KnownBits computeForAddCarry( assert(!(CarryZero && CarryOne) && "Carry can't be zero and one at the same time"); - APInt PossibleSumZero = ~LHS.Zero + ~RHS.Zero + !CarryZero; - APInt PossibleSumOne = LHS.One + RHS.One + CarryOne; + APInt PossibleSumZero = LHS.getMaxValue() + RHS.getMaxValue() + !CarryZero; + APInt PossibleSumOne = LHS.getMinValue() + RHS.getMinValue() + CarryOne; // Compute known bits of the carry. APInt CarryKnownZero = ~(PossibleSumZero ^ LHS.Zero ^ RHS.Zero); |