[PATCH] D145987: [ADT][NFCI] Do not use non-const lvalue-refs with enumerate in llvm/

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 13 15:34:54 PDT 2023


dblaikie accepted this revision.
dblaikie added a comment.
This revision is now accepted and ready to land.

Looks alright - thanks! :)



================
Comment at: llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp:3962
       int InitialOffset = std::get<1>(Vec[0]);
-      AnyConsecutive |= all_of(enumerate(Vec), [InitialOffset](auto &P) {
+      AnyConsecutive |= all_of(enumerate(Vec), [InitialOffset](auto &&P) {
         return std::get<1>(P.value()) == int(P.index()) + InitialOffset;
----------------
I'd probably pass by const ref here - the forwarding ref seems a bit more general than needed/looks like there could be ownership transfer, etc.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145987



More information about the cfe-commits mailing list