summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-01-24 02:10:15 +0000
committerCraig Topper <craig.topper@gmail.com>2017-01-24 02:10:15 +0000
commit9028f0556d24266cc76996319735531ddf2b71b1 (patch)
treefbeb1ed4f9bbabd51393f45c3f873e10022f5fec /llvm/lib/Support
parentea2dc026686ac21ad44e52519198b147ac5cf11a (diff)
downloadbcm5719-llvm-9028f0556d24266cc76996319735531ddf2b71b1.tar.gz
bcm5719-llvm-9028f0556d24266cc76996319735531ddf2b71b1.zip
[APInt] Remove calls to clearUnusedBits from XorSlowCase and operator^=
Summary: There's a comment in XorSlowCase that says "0^0==1" which isn't true. 0 xored with 0 is still 0. So I don't think we need to clear any unused bits here. Now there is no difference between XorSlowCase and AndSlowCase/OrSlowCase other than the operation being performed Reviewers: majnemer, MatzeB, chandlerc, bkramer Reviewed By: MatzeB Subscribers: chfast, llvm-commits Differential Revision: https://reviews.llvm.org/D28986 llvm-svn: 292873
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/APInt.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index fb8b45166a4..bc3e4b2666b 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -440,13 +440,12 @@ APInt& APInt::operator^=(const APInt& RHS) {
assert(BitWidth == RHS.BitWidth && "Bit widths must be the same");
if (isSingleWord()) {
VAL ^= RHS.VAL;
- this->clearUnusedBits();
return *this;
}
unsigned numWords = getNumWords();
for (unsigned i = 0; i < numWords; ++i)
pVal[i] ^= RHS.pVal[i];
- return clearUnusedBits();
+ return *this;
}
APInt APInt::AndSlowCase(const APInt& RHS) const {
@@ -471,10 +470,7 @@ APInt APInt::XorSlowCase(const APInt& RHS) const {
for (unsigned i = 0; i < numWords; ++i)
val[i] = pVal[i] ^ RHS.pVal[i];
- APInt Result(val, getBitWidth());
- // 0^0==1 so clear the high bits in case they got set.
- Result.clearUnusedBits();
- return Result;
+ return APInt(val, getBitWidth());
}
APInt APInt::operator*(const APInt& RHS) const {
OpenPOWER on IntegriCloud