[APInt] Remove an APInt copy from the return of APInt::multiplicativeInverse.

llvm-svn: 302816
This commit is contained in:
Craig Topper 2017-05-11 18:40:53 +00:00
parent 3fbecadab6
commit dbd6219f81
1 changed files with 4 additions and 1 deletions

View File

@ -1141,7 +1141,10 @@ APInt APInt::multiplicativeInverse(const APInt& modulo) const {
// interested in a positive inverse. Calculate a positive one from a negative // interested in a positive inverse. Calculate a positive one from a negative
// one if necessary. A simple addition of the modulo suffices because // 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). // 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 /// Calculate the magic numbers required to implement a signed integer division