]> granicus.if.org Git - llvm/commitdiff
[APInt] Use negate() instead of copying an APInt to negate it and then writing back...
authorCraig Topper <craig.topper@gmail.com>
Thu, 11 May 2017 07:02:04 +0000 (07:02 +0000)
committerCraig Topper <craig.topper@gmail.com>
Thu, 11 May 2017 07:02:04 +0000 (07:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@302770 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Support/APInt.cpp

index d43140b355159ea598a62dd9f094b3e9ea3cc9d3..d000ae82e0746c77cd03ea320aee40548b121544 100644 (file)
@@ -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);
   }