summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-05-11 07:02:04 +0000
committerCraig Topper <craig.topper@gmail.com>2017-05-11 07:02:04 +0000
commitb3c1f567373d5895752b69d1ccece90813447fa9 (patch)
treefbb4e24812a3a152693e86b6f27390f9220f52af /llvm/lib/Support/APInt.cpp
parente3e1a35f68f0053e24725e30f4f6a4496efab324 (diff)
downloadbcm5719-llvm-b3c1f567373d5895752b69d1ccece90813447fa9.tar.gz
bcm5719-llvm-b3c1f567373d5895752b69d1ccece90813447fa9.zip
[APInt] Use negate() instead of copying an APInt to negate it and then writing back over the original value.
llvm-svn: 302770
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index d43140b3551..d000ae82e07 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/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);
}
OpenPOWER on IntegriCloud