diff options
author | Craig Topper <craig.topper@gmail.com> | 2017-04-29 17:46:11 +0000 |
---|---|---|
committer | Craig Topper <craig.topper@gmail.com> | 2017-04-29 17:46:11 +0000 |
commit | 685327dd99fbbc08c9243ca41e874eccf31778e4 (patch) | |
tree | eeb954d69d2728a83978b89c86c8c4b2a8effbe0 /llvm/lib | |
parent | e9fdba39e005bbb8abb90aacf80e75a477b51208 (diff) | |
download | bcm5719-llvm-685327dd99fbbc08c9243ca41e874eccf31778e4.tar.gz bcm5719-llvm-685327dd99fbbc08c9243ca41e874eccf31778e4.zip |
[ConstantRange] Use APInt::operator-= to remove temporary APInts.
llvm-svn: 301751
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/IR/ConstantRange.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/IR/ConstantRange.cpp b/llvm/lib/IR/ConstantRange.cpp index fd678c28256..754844e371a 100644 --- a/llvm/lib/IR/ConstantRange.cpp +++ b/llvm/lib/IR/ConstantRange.cpp @@ -597,7 +597,7 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { if (LowerDiv.uge(MaxValue)) { APInt Div(getBitWidth(), 0); APInt::udivrem(LowerDiv, MaxBitValue, Div, LowerDiv); - UpperDiv = UpperDiv - MaxBitValue * Div; + UpperDiv -= MaxBitValue * Div; } if (UpperDiv.ule(MaxValue)) @@ -605,10 +605,10 @@ ConstantRange ConstantRange::truncate(uint32_t DstTySize) const { UpperDiv.trunc(DstTySize)).unionWith(Union); // The truncated value wraps around. Check if we can do better than fullset. - APInt UpperModulo = UpperDiv - MaxBitValue; - if (UpperModulo.ult(LowerDiv)) + UpperDiv -= MaxBitValue; + if (UpperDiv.ult(LowerDiv)) return ConstantRange(LowerDiv.trunc(DstTySize), - UpperModulo.trunc(DstTySize)).unionWith(Union); + UpperDiv.trunc(DstTySize)).unionWith(Union); return ConstantRange(DstTySize, /*isFullSet=*/true); } |