From 8894742d7d3e60b377be2c1a368753429f8aa7f2 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Mon, 8 May 2017 23:49:49 +0000 Subject: [PATCH] [APInt] Remove 'else' after 'return' in udiv and urem. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302486 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/APInt.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index caa0691f920..774fe86f106 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1588,16 +1588,15 @@ APInt APInt::udiv(const APInt& RHS) const { 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) const { 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); -- 2.50.1