[llvm-commits] [llvm] r62047 - /llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner sabre at nondot.org
Sun Jan 11 12:41:37 PST 2009


Author: lattner
Date: Sun Jan 11 14:41:36 2009
New Revision: 62047

URL: http://llvm.org/viewvc/llvm-project?rev=62047&view=rev
Log:
Duncan is nervous about undefinedness of % with negatives.  I'm
not thrilled about 64-bit % in general, so rewrite to use * instead.

Modified:
    llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp

Modified: llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp?rev=62047&r1=62046&r2=62047&view=diff

==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Sun Jan 11 14:41:36 2009
@@ -7710,7 +7710,7 @@
   int64_t FirstIdx = 0;
   if (int64_t TySize = TD->getABITypeSize(Ty)) {
     FirstIdx = Offset/TySize;
-    Offset %= TySize;
+    Offset -= FirstIdx*TySize;
     
     // Handle hosts where % returns negative instead of values [0..TySize).
     if (Offset < 0) {





More information about the llvm-commits mailing list