[llvm-commits] [llvm] r92124 - /llvm/trunk/lib/Support/APInt.cpp

John McCall rjmccall at apple.com
Thu Dec 24 00:52:06 PST 2009


Author: rjmccall
Date: Thu Dec 24 02:52:06 2009
New Revision: 92124

URL: http://llvm.org/viewvc/llvm-project?rev=92124&view=rev
Log:
Set Remainder before Quotient in case Quotient and LHS alias.  The new
order should be immune to such problems.


Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=92124&r1=92123&r2=92124&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Thu Dec 24 02:52:06 2009
@@ -2012,8 +2012,8 @@
   }
 
   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;
   }
 





More information about the llvm-commits mailing list