From bd8d1e35a6738e7c74ca153bf1709edfe2babfea Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 24 Dec 2009 08:52:06 +0000 Subject: Set Remainder before Quotient in case Quotient and LHS alias. The new order should be immune to such problems. llvm-svn: 92124 --- llvm/lib/Support/APInt.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/Support/APInt.cpp') diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp index 56d4773..9532e1e 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; } -- cgit v1.1