From e74359195a0493eaab7dfde614cc0ffa97d65710 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 11 May 2017 07:02:04 +0000 Subject: [PATCH] [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 --- lib/Support/APInt.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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); } -- 2.50.1