summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-11 18:40:53 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-11 18:40:53 +0000
commitdbd6219f8197c2b95b33e7a83d02d87721eff649 (patch)
tree7085bf1df477fb14d20b984af67d62119a6fab75 /llvm/lib/Support/APInt.cpp
parent3fbecadab632f4caec1d0d5c05db2eeb2a78333b (diff)
downloadbcm5719-llvm-dbd6219f8197c2b95b33e7a83d02d87721eff649.tar.gz
bcm5719-llvm-dbd6219f8197c2b95b33e7a83d02d87721eff649.zip
[APInt] Remove an APInt copy from the return of APInt::multiplicativeInverse.
llvm-svn: 302816
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 0fade287d43..bcec648ad0c 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1141,7 +1141,10 @@ APInt APInt::multiplicativeInverse(const APInt& modulo) const {
// interested in a positive inverse. Calculate a positive one from a negative
// one if necessary. A simple addition of the modulo suffices because
// abs(t[i]) is known to be less than *this/2 (see the link above).
- return t[i].isNegative() ? t[i] + modulo : t[i];
+ if (t[i].isNegative())
+ t[i] += modulo;
+
+ return std::move(t[i]);
}
/// Calculate the magic numbers required to implement a signed integer division
OpenPOWER on IntegriCloud