mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-11 13:46:13 +00:00
[Constants] Use APInt::isNullValue/isOneValue/uge to simplify some code and take advantage of APInt optimizations. NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304855 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9082d12000
commit
c68553cb7f
@ -194,7 +194,7 @@ public:
|
||||
/// common code. It also correctly performs the comparison without the
|
||||
/// potential for an assertion from getZExtValue().
|
||||
bool isZero() const {
|
||||
return Val == 0;
|
||||
return Val.isNullValue();
|
||||
}
|
||||
|
||||
/// This is just a convenience method to make client code smaller for a
|
||||
@ -202,7 +202,7 @@ public:
|
||||
/// potential for an assertion from getZExtValue().
|
||||
/// @brief Determine if the value is one.
|
||||
bool isOne() const {
|
||||
return Val == 1;
|
||||
return Val.isOneValue();
|
||||
}
|
||||
|
||||
/// This function will return true iff every bit in this constant is set
|
||||
@ -243,7 +243,7 @@ public:
|
||||
/// @returns true iff this constant is greater or equal to the given number.
|
||||
/// @brief Determine if the value is greater or equal to the given number.
|
||||
bool uge(uint64_t Num) const {
|
||||
return Val.getActiveBits() > 64 || Val.getZExtValue() >= Num;
|
||||
return Val.uge(Num);
|
||||
}
|
||||
|
||||
/// getLimitedValue - If the value is smaller than the specified limit,
|
||||
|
@ -127,7 +127,7 @@ bool Constant::isOneValue() const {
|
||||
|
||||
// Check for FP which are bitcasted from 1 integers
|
||||
if (const ConstantFP *CFP = dyn_cast<ConstantFP>(this))
|
||||
return CFP->getValueAPF().bitcastToAPInt() == 1;
|
||||
return CFP->getValueAPF().bitcastToAPInt().isOneValue();
|
||||
|
||||
// Check for constant vectors which are splats of 1 values.
|
||||
if (const ConstantVector *CV = dyn_cast<ConstantVector>(this))
|
||||
|
Loading…
Reference in New Issue
Block a user