[llvm] r253792 - Use modulo operator instead of multiplying result of a divide and subtracting from the original dividend. NFC.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 21 09:44:42 PST 2015


Author: ctopper
Date: Sat Nov 21 11:44:42 2015
New Revision: 253792

URL: http://llvm.org/viewvc/llvm-project?rev=253792&view=rev
Log:
Use modulo operator instead of multiplying result of a divide and subtracting from the original dividend. NFC.

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

Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=253792&r1=253791&r2=253792&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Sat Nov 21 11:44:42 2015
@@ -190,7 +190,7 @@ bool MemsetRange::isProfitableToUseMemse
   unsigned NumPointerStores = Bytes / MaxIntSize;
 
   // Assume the remaining bytes if any are done a byte at a time.
-  unsigned NumByteStores = Bytes - NumPointerStores * MaxIntSize;
+  unsigned NumByteStores = Bytes % MaxIntSize;
 
   // If we will reduce the # stores (according to this heuristic), do the
   // transformation.  This encourages merging 4 x i8 -> i32 and 2 x i16 -> i32




More information about the llvm-commits mailing list