[libcxx-commits] [PATCH] D67273: [libc++] Remove unnecessary assignment in exclusive_scan

Billy Robert O'Neal III via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Fri Sep 6 09:28:55 PDT 2019


BillyONeal added a comment.

That's worse; it replaced 2n assignments with n assignments, n constructions, and n destructions. Interestingly, assigning over __saved is an optimization I should put into MSVC.

My Twitter comment was about the last __init = _VSTD::move(__tmp) when __first == __last;

  for (;;)
  {
      _Tp __tmp = __b(__init, *__first);
      *__result = __init;
  
      ++__result;
      if (++__first == __last) break;
      __init = _VSTD::move(__tmp);
  }

saves the last assignment.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67273/new/

https://reviews.llvm.org/D67273





More information about the libcxx-commits mailing list