[APInt] Use negate() instead of copying an APInt to negate it and then writing back over the original value.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302770 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Craig Topper 2017-05-11 07:02:04 +00:00
parent ada33d729b
commit e74359195a

View File

@ -1710,12 +1710,12 @@ void APInt::sdivrem(const APInt &LHS, const APInt &RHS,
APInt::udivrem(-LHS, -RHS, Quotient, Remainder); APInt::udivrem(-LHS, -RHS, Quotient, Remainder);
else { else {
APInt::udivrem(-LHS, RHS, Quotient, Remainder); APInt::udivrem(-LHS, RHS, Quotient, Remainder);
Quotient = -Quotient; Quotient.negate();
} }
Remainder = -Remainder; Remainder.negate();
} else if (RHS.isNegative()) { } else if (RHS.isNegative()) {
APInt::udivrem(LHS, -RHS, Quotient, Remainder); APInt::udivrem(LHS, -RHS, Quotient, Remainder);
Quotient = -Quotient; Quotient.negate();
} else { } else {
APInt::udivrem(LHS, RHS, Quotient, Remainder); APInt::udivrem(LHS, RHS, Quotient, Remainder);
} }