llvm.org GIT mirror llvm / 2adf8cc
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 Jakub Staszak 7 years ago
3 changed file(s) with 12 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
160160 }
161161
162162 APSInt& operator++() {
163 static_cast(*this)++;
163 ++(static_cast(*this));
164164 return *this;
165165 }
166166 APSInt& operator--() {
167 static_cast(*this)--;
167 --(static_cast(*this));
168168 return *this;
169169 }
170170 APSInt operator++(int) {
29992999 uint32_t BitWidth = C.getBitWidth();
30003000 switch (pred) {
30013001 default: llvm_unreachable("Invalid ICmp opcode to ConstantRange ctor!");
3002 case ICmpInst::ICMP_EQ: Upper++; break;
3003 case ICmpInst::ICMP_NE: Lower++; break;
3002 case ICmpInst::ICMP_EQ: ++Upper; break;
3003 case ICmpInst::ICMP_NE: ++Lower; break;
30043004 case ICmpInst::ICMP_ULT:
30053005 Lower = APInt::getMinValue(BitWidth);
30063006 // Check for an empty-set condition.
30143014 return ConstantRange(BitWidth, /*isFullSet=*/false);
30153015 break;
30163016 case ICmpInst::ICMP_UGT:
3017 Lower++; Upper = APInt::getMinValue(BitWidth); // Min = Next(Max)
3017 ++Lower; Upper = APInt::getMinValue(BitWidth); // Min = Next(Max)
30183018 // Check for an empty-set condition.
30193019 if (Lower == Upper)
30203020 return ConstantRange(BitWidth, /*isFullSet=*/false);
30213021 break;
30223022 case ICmpInst::ICMP_SGT:
3023 Lower++; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max)
3023 ++Lower; Upper = APInt::getSignedMinValue(BitWidth); // Min = Next(Max)
30243024 // Check for an empty-set condition.
30253025 if (Lower == Upper)
30263026 return ConstantRange(BitWidth, /*isFullSet=*/false);
30273027 break;
30283028 case ICmpInst::ICMP_ULE:
3029 Lower = APInt::getMinValue(BitWidth); Upper++;
3029 Lower = APInt::getMinValue(BitWidth); ++Upper;
30303030 // Check for a full-set condition.
30313031 if (Lower == Upper)
30323032 return ConstantRange(BitWidth, /*isFullSet=*/true);
30333033 break;
30343034 case ICmpInst::ICMP_SLE:
3035 Lower = APInt::getSignedMinValue(BitWidth); Upper++;
3035 Lower = APInt::getSignedMinValue(BitWidth); ++Upper;
30363036 // Check for a full-set condition.
30373037 if (Lower == Upper)
30383038 return ConstantRange(BitWidth, /*isFullSet=*/true);
558558 if (lhsNeg) {
559559 // Sign bit is set so perform two's complement to make it positive
560560 lhs.flipAllBits();
561 lhs++;
561 ++lhs;
562562 }
563563 if (rhsNeg) {
564564 // Sign bit is set so perform two's complement to make it positive
565565 rhs.flipAllBits();
566 rhs++;
566 ++rhs;
567567 }
568568
569569 // Now we have unsigned values to compare so do the comparison if necessary
21152115 }
21162116 // If its negative, put it in two's complement form
21172117 if (isNeg) {
2118 (*this)--;
2118 --(*this);
21192119 this->flipAllBits();
21202120 }
21212121 }
21962196 // Flip the bits and add one to turn it into the equivalent positive
21972197 // value and put a '-' in the result.
21982198 Tmp.flipAllBits();
2199 Tmp++;
2199 ++Tmp;
22002200 Str.push_back('-');
22012201 }
22022202