[PATCH] D26991: Hoist redundant load

Aditya Kumar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 29 06:38:35 PST 2016


hiraditya added inline comments.


================
Comment at: libcxx/include/algorithm:1499
+    // Load the first element from __first2 outside the loop because it is loop invariant
+    typename iterator_traits<_RandomAccessIterator1>::value_type __firstElement2 = *__first2;
+
----------------
mclow.lists wrote:
> I just realized that we can't do this.
> This imposes a requirement that the `value_type` be copy-constructible.
> 
> With this in place, we can't search a sequence of move-only types.
Ok, I'll remove this change while pushing. I'll change the subject as well, because now this patch is just removing the unused code.
Thanks for the review.


https://reviews.llvm.org/D26991





More information about the cfe-commits mailing list