[llvm] r302486 - [APInt] Remove 'else' after 'return' in udiv and urem. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Mon May 8 16:49:49 PDT 2017
Author: ctopper
Date: Mon May 8 18:49:49 2017
New Revision: 302486
URL: http://llvm.org/viewvc/llvm-project?rev=302486&view=rev
Log:
[APInt] Remove 'else' after 'return' in udiv and urem. NFC
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=302486&r1=302485&r2=302486&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Mon May 8 18:49:49 2017
@@ -1588,16 +1588,15 @@ APInt APInt::udiv(const APInt& RHS) cons
if (!lhsWords)
// 0 / X ===> 0
return APInt(BitWidth, 0);
- else if (lhsWords < rhsWords || this->ult(RHS)) {
+ if (lhsWords < rhsWords || this->ult(RHS))
// X / Y ===> 0, iff X < Y
return APInt(BitWidth, 0);
- } else if (*this == RHS) {
+ if (*this == RHS)
// X / X ===> 1
return APInt(BitWidth, 1);
- } else if (lhsWords == 1 && rhsWords == 1) {
+ if (lhsWords == 1 && rhsWords == 1)
// All high words are zero, just use native divide
return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]);
- }
// We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Quotient(1,0); // to hold result.
@@ -1633,19 +1632,18 @@ APInt APInt::urem(const APInt& RHS) cons
assert(rhsWords && "Performing remainder operation by zero ???");
// Check the degenerate cases
- if (lhsWords == 0) {
+ if (lhsWords == 0)
// 0 % Y ===> 0
return APInt(BitWidth, 0);
- } else if (lhsWords < rhsWords || this->ult(RHS)) {
+ if (lhsWords < rhsWords || this->ult(RHS))
// X % Y ===> X, iff X < Y
return *this;
- } else if (*this == RHS) {
+ if (*this == RHS)
// X % X == 0;
return APInt(BitWidth, 0);
- } else if (lhsWords == 1) {
+ if (lhsWords == 1)
// All high words are zero, just use native remainder
return APInt(BitWidth, U.pVal[0] % RHS.U.pVal[0]);
- }
// We have to compute it the hard way. Invoke the Knuth divide algorithm.
APInt Remainder(1,0);
More information about the llvm-commits
mailing list