summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2009-12-24 08:52:06 +0000
committerJohn McCall <rjmccall@apple.com>2009-12-24 08:52:06 +0000
commitbd8d1e35a6738e7c74ca153bf1709edfe2babfea (patch)
tree345002c06457547f1efe242c78865f172aa12c56 /llvm/lib/Support/APInt.cpp
parentd538a6d364b2555733240618a333363855425625 (diff)
downloadbcm5719-llvm-bd8d1e35a6738e7c74ca153bf1709edfe2babfea.tar.gz
bcm5719-llvm-bd8d1e35a6738e7c74ca153bf1709edfe2babfea.zip
Set Remainder before Quotient in case Quotient and LHS alias. The new
order should be immune to such problems. llvm-svn: 92124
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index 56d47736eab..9532e1e160b 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -2012,8 +2012,8 @@ void APInt::udivrem(const APInt &LHS, const APInt &RHS,
}
if (lhsWords < rhsWords || LHS.ult(RHS)) {
- Quotient = 0; // X / Y ===> 0, iff X < Y
Remainder = LHS; // X % Y ===> X, iff X < Y
+ Quotient = 0; // X / Y ===> 0, iff X < Y
return;
}
OpenPOWER on IntegriCloud