From a5ea5289ff7ac8d02cf4e990300c0fbf4869b905 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sat, 21 Nov 2015 17:44:42 +0000 Subject: [PATCH] Use modulo operator instead of multiplying result of a divide and subtracting from the original dividend. NFC. llvm-svn: 253792 --- llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 7594956f8dd9..5997464dd0c0 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -190,7 +190,7 @@ bool MemsetRange::isProfitableToUseMemset(const DataLayout &DL) const { 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