summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-12 18:18:57 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-12 18:18:57 +0000
commit06da0816fdea8fae5460fd177f6378fa403795d0 (patch)
treeb935f1f4cad6db2d09da5d697efbd67a8c12bc03 /llvm/lib/Support/APInt.cpp
parent3041982dd18f1877fc44ad76e45d7d93957e9212 (diff)
downloadbcm5719-llvm-06da0816fdea8fae5460fd177f6378fa403795d0.tar.gz
bcm5719-llvm-06da0816fdea8fae5460fd177f6378fa403795d0.zip
[APInt] Remove unnecessary checks of rhsWords==1 with lhsWords==1 from udiv and udivrem. NFC
At this point in the code rhsWords is guaranteed to be non-zero and less than or equal to lhsWords. So if lhsWords is 1, rhsWords must also be 1. urem alread had the check removed so this makes all 3 consistent. llvm-svn: 302930
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 361fc97c2ec..a5ffcb2e96d 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1579,7 +1579,7 @@ APInt APInt::udiv(const APInt& RHS) const {
if (*this == RHS)
// X / X ===> 1
return APInt(BitWidth, 1);
- if (lhsWords == 1 && rhsWords == 1)
+ if (lhsWords == 1) // rhsWords is 1 if lhsWords is 1.
// All high words are zero, just use native divide
return APInt(BitWidth, this->U.pVal[0] / RHS.U.pVal[0]);
@@ -1682,7 +1682,7 @@ void APInt::udivrem(const APInt &LHS, const APInt &RHS,
return;
}
- if (lhsWords == 1 && rhsWords == 1) {
+ if (lhsWords == 1) { // rhsWords is 1 if lhsWords is 1.
// There is only one word to consider so use the native versions.
uint64_t lhsValue = LHS.U.pVal[0];
uint64_t rhsValue = RHS.U.pVal[0];
OpenPOWER on IntegriCloud