mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00
Use pre-inc, pre-dec when possible.
They are generally faster (at least not slower) than post-inc, post-dec. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@177608 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f19e5db5f
commit
2adf8ccbf0
@ -161,11 +161,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
APSInt& operator++() {
|
APSInt& operator++() {
|
||||||
static_cast<APInt&>(*this)++;
|
++(static_cast<APInt&>(*this));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
APSInt& operator--() {
|
APSInt& operator--() {
|
||||||
static_cast<APInt&>(*this)--;
|
--(static_cast<APInt&>(*this));
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
APSInt operator++(int) {
|
APSInt operator++(int) {
|
||||||
|
@ -3000,8 +3000,8 @@ ICmpInst::makeConstantRange(Predicate pred, const APInt &C) {
|
|||||||
uint32_t BitWidth = C.getBitWidth();
|
uint32_t BitWidth = C.getBitWidth();
|
||||||
switch (pred) {
|
switch (pred) {
|
||||||
default: llvm_unreachable("Invalid ICmp opcode to ConstantRange ctor!");
|
default: llvm_unreachable("Invalid ICmp opcode to ConstantRange ctor!");
|
||||||
case ICmpInst::ICMP_EQ: Upper++; break;
|
case ICmpInst::ICMP_EQ: ++Upper; break;
|
||||||
case ICmpInst::ICMP_NE: Lower++; break;
|
case ICmpInst::ICMP_NE: ++Lower; break;
|
||||||
case ICmpInst::ICMP_ULT:
|
case ICmpInst::ICMP_ULT:
|
||||||
Lower = APInt::getMinValue(BitWidth);
|
Lower = APInt::getMinValue(BitWidth);
|
||||||
// Check for an empty-set condition.
|
// Check for an empty-set condition.
|
||||||
@ -3015,25 +3015,25 @@ ICmpInst::makeConstantRange(Predicate pred, const APInt &C) {
|
|||||||
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
||||||
break;
|
break;
|
||||||
case ICmpInst::ICMP_UGT:
|
case ICmpInst::ICMP_UGT:
|
||||||
Lower++; Upper = APInt::getMinValue(BitWidth); // Min = Next(Max)
|
++Lower; Upper = APInt::getMinValue(BitWidth); // Min = Next(Max)
|
||||||
// Check for an empty-set condition.
|
// Check for an empty-set condition.
|
||||||
if (Lower == Upper)
|
if (Lower == Upper)
|
||||||
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
||||||
break;
|
break;
|
||||||
case ICmpInst::ICMP_SGT:
|
case ICmpInst::ICMP_SGT:
|
||||||
Lower++; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max)
|
++Lower; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max)
|
||||||
// Check for an empty-set condition.
|
// Check for an empty-set condition.
|
||||||
if (Lower == Upper)
|
if (Lower == Upper)
|
||||||
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
return ConstantRange(BitWidth, /*isFullSet=*/false);
|
||||||
break;
|
break;
|
||||||
case ICmpInst::ICMP_ULE:
|
case ICmpInst::ICMP_ULE:
|
||||||
Lower = APInt::getMinValue(BitWidth); Upper++;
|
Lower = APInt::getMinValue(BitWidth); ++Upper;
|
||||||
// Check for a full-set condition.
|
// Check for a full-set condition.
|
||||||
if (Lower == Upper)
|
if (Lower == Upper)
|
||||||
return ConstantRange(BitWidth, /*isFullSet=*/true);
|
return ConstantRange(BitWidth, /*isFullSet=*/true);
|
||||||
break;
|
break;
|
||||||
case ICmpInst::ICMP_SLE:
|
case ICmpInst::ICMP_SLE:
|
||||||
Lower = APInt::getSignedMinValue(BitWidth); Upper++;
|
Lower = APInt::getSignedMinValue(BitWidth); ++Upper;
|
||||||
// Check for a full-set condition.
|
// Check for a full-set condition.
|
||||||
if (Lower == Upper)
|
if (Lower == Upper)
|
||||||
return ConstantRange(BitWidth, /*isFullSet=*/true);
|
return ConstantRange(BitWidth, /*isFullSet=*/true);
|
||||||
|
@ -559,12 +559,12 @@ bool APInt::slt(const APInt& RHS) const {
|
|||||||
if (lhsNeg) {
|
if (lhsNeg) {
|
||||||
// Sign bit is set so perform two's complement to make it positive
|
// Sign bit is set so perform two's complement to make it positive
|
||||||
lhs.flipAllBits();
|
lhs.flipAllBits();
|
||||||
lhs++;
|
++lhs;
|
||||||
}
|
}
|
||||||
if (rhsNeg) {
|
if (rhsNeg) {
|
||||||
// Sign bit is set so perform two's complement to make it positive
|
// Sign bit is set so perform two's complement to make it positive
|
||||||
rhs.flipAllBits();
|
rhs.flipAllBits();
|
||||||
rhs++;
|
++rhs;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now we have unsigned values to compare so do the comparison if necessary
|
// Now we have unsigned values to compare so do the comparison if necessary
|
||||||
@ -2116,7 +2116,7 @@ void APInt::fromString(unsigned numbits, StringRef str, uint8_t radix) {
|
|||||||
}
|
}
|
||||||
// If its negative, put it in two's complement form
|
// If its negative, put it in two's complement form
|
||||||
if (isNeg) {
|
if (isNeg) {
|
||||||
(*this)--;
|
--(*this);
|
||||||
this->flipAllBits();
|
this->flipAllBits();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2197,7 +2197,7 @@ void APInt::toString(SmallVectorImpl<char> &Str, unsigned Radix,
|
|||||||
// Flip the bits and add one to turn it into the equivalent positive
|
// Flip the bits and add one to turn it into the equivalent positive
|
||||||
// value and put a '-' in the result.
|
// value and put a '-' in the result.
|
||||||
Tmp.flipAllBits();
|
Tmp.flipAllBits();
|
||||||
Tmp++;
|
++Tmp;
|
||||||
Str.push_back('-');
|
Str.push_back('-');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user