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

Nick Lewycky nlewycky at google.com
Fri Jul 17 20:25:19 PDT 2015


On 17 July 2015 at 01:56, Anthony Pesch <inolen at gmail.com> wrote:

> 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().
>

LGTM


>
>
> Repository:
>   rL LLVM
>
> http://reviews.llvm.org/D11198
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150717/ef310dba/attachment.html>


More information about the llvm-commits mailing list