summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-04-28 03:36:24 +0000
committerCraig Topper <craig.topper@gmail.com>2017-04-28 03:36:24 +0000
commit24e71017aa3a062e6c2b055038ab9ed0ad2d35ae (patch)
tree461d640d885493861683e8350040434e9a912a74 /llvm/lib/Support/APInt.cpp
parentf74d946624f30d60fd3f90a9545a455308931c32 (diff)
downloadbcm5719-llvm-24e71017aa3a062e6c2b055038ab9ed0ad2d35ae.tar.gz
bcm5719-llvm-24e71017aa3a062e6c2b055038ab9ed0ad2d35ae.zip
[APInt] Use inplace shift methods where possible. NFCI
llvm-svn: 301612
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 1227d7528c8..7103007d8ca 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -844,7 +844,7 @@ APInt llvm::APIntOps::RoundDoubleToAPInt(double Double, unsigned width) {
// Otherwise, we have to shift the mantissa bits up to the right location
APInt Tmp(width, mantissa);
- Tmp = Tmp.shl((unsigned)exp - 52);
+ Tmp <<= (unsigned)exp - 52;
return isNeg ? -Tmp : Tmp;
}
@@ -1072,9 +1072,10 @@ void APInt::lshrSlowCase(unsigned ShiftAmt) {
/// Left-shift this APInt by shiftAmt.
/// @brief Left-shift function.
-APInt APInt::shl(const APInt &shiftAmt) const {
+APInt &APInt::operator<<=(const APInt &shiftAmt) {
// It's undefined behavior in C to shift by BitWidth or greater.
- return shl((unsigned)shiftAmt.getLimitedValue(BitWidth));
+ *this <<= (unsigned)shiftAmt.getLimitedValue(BitWidth);
+ return *this;
}
void APInt::shlSlowCase(unsigned ShiftAmt) {
OpenPOWER on IntegriCloud