diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -111,24 +111,26 @@ bool no_undef = true; for (Instruction *SI : TheStores) { if (auto *Store = dyn_cast(SI)) { - Value *StoredVal = Store->getValueOperand(); - if (!isa(StoredVal)) - non_undef_stores++; - else - no_undef = false; + Value *StoredVal = Store->getValueOperand(); + if (!isa(StoredVal)) + non_undef_stores++; + else + no_undef = false; } else { - // If any of the stores are a memset, then it is always good to extend the - // memset. - return true; + // If any of the stores are a memset, then it is always good to extend the + // memset. + return true; } } // If we found more than 4 stores to merge or 16 bytes, use memset. - if (non_undef_stores >= 4 || (no_undef && End-Start >= 16)) return true; + if (non_undef_stores >= 4 || (no_undef && End - Start >= 16)) + return true; // If there is nothing to merge, don't do anything. // Assume that the code generator is capable of merging pairs of stores // together if it wants to. - if (non_undef_stores <= 2) return false; + if (non_undef_stores <= 2) + return false; // If we have fewer than 8 stores, it can still be worthwhile to do this. // For example, merging 4 i8 stores into an i32 store is useful almost always. @@ -152,7 +154,7 @@ // 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 // etc. - return non_undef_stores > NumPointerStores+NumByteStores; + return non_undef_stores > NumPointerStores + NumByteStores; } namespace {