Set Remainder before Quotient in case Quotient and LHS alias. The new

order should be immune to such problems.

llvm-svn: 92124
This commit is contained in:
John McCall 2009-12-24 08:52:06 +00:00
parent d538a6d364
commit bd8d1e35a6

View File

@ -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;
}