[PATCH] D11198: Avoid insertion sorting each new range in MemCpyOptimizer

Anthony Pesch inolen at gmail.com
Fri Jul 17 01:56:02 PDT 2015


inolen added inline comments.

================
Comment at: lib/Transforms/Scalar/MemCpyOptimizer.cpp:255
@@ -261,3 +254,3 @@
   // to insert a new range.  Handle this now.
-  if (I == E || End < I->Start) {
+  if (I == Ranges.end() || End < I->Start) {
     MemsetRange &R = *Ranges.insert(I, MemsetRange());
----------------
nicholas wrote:
> Optional: consider hoisting "Ranges.end()" out to "range_iterator E = Ranges.end;". See http://llvm.org/docs/CodingStandards.html#don-t-evaluate-end-every-time-through-a-loop .
I'd removed the end iterator local due to it being invalidated during the loop at the bottom which calls Ranges.erase().


Repository:
  rL LLVM

http://reviews.llvm.org/D11198







More information about the llvm-commits mailing list