Index: lib/Support/APInt.cpp =================================================================== --- lib/Support/APInt.cpp +++ lib/Support/APInt.cpp @@ -440,13 +440,12 @@ 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 { @@ -470,11 +469,7 @@ uint64_t *val = getMemory(numWords); 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 {