From: Craig Topper Date: Thu, 11 May 2017 07:02:04 +0000 (+0000) Subject: [APInt] Use negate() instead of copying an APInt to negate it and then writing back... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e74359195a0493eaab7dfde614cc0ffa97d65710;p=llvm [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 --- diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index d43140b3551..d000ae82e07 100644 --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1710,12 +1710,12 @@ void APInt::sdivrem(const APInt &LHS, const APInt &RHS, APInt::udivrem(-LHS, -RHS, Quotient, Remainder); else { APInt::udivrem(-LHS, RHS, Quotient, Remainder); - Quotient = -Quotient; + Quotient.negate(); } - Remainder = -Remainder; + Remainder.negate(); } else if (RHS.isNegative()) { APInt::udivrem(LHS, -RHS, Quotient, Remainder); - Quotient = -Quotient; + Quotient.negate(); } else { APInt::udivrem(LHS, RHS, Quotient, Remainder); }