1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[KnownBits] isNonZero() - avoid expensive countPopulation call. NFC.

We can just check for a null value.
This commit is contained in:
Simon Pilgrim 2020-11-08 10:30:29 +00:00
parent 738feb9acf
commit 1485c86dd7

View File

@ -98,7 +98,7 @@ public:
bool isNonNegative() const { return Zero.isSignBitSet(); }
/// Returns true if this value is known to be non-zero.
bool isNonZero() const { return One.countPopulation() != 0; }
bool isNonZero() const { return !One.isNullValue(); }
/// Returns true if this value is known to be positive.
bool isStrictlyPositive() const { return Zero.isSignBitSet() && !One.isNullValue(); }