From: John McCall Date: Thu, 24 Dec 2009 08:52:06 +0000 (+0000) Subject: Set Remainder before Quotient in case Quotient and LHS alias. The new X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=d73bf5987a0855e677fcefba74334c6a85b0b326;p=oota-llvm.git Set Remainder before Quotient in case Quotient and LHS alias. The new order should be immune to such problems. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92124 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Support/APInt.cpp b/lib/Support/APInt.cpp index 56d47736eab..9532e1e160b 100644 --- a/lib/Support/APInt.cpp +++ b/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; }