This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by kuhar on Mar 13 2023, 1:39 PM.

Details

Summary

Replace references to enumerate results with either const lvalue
rerences or structured bindings. I did not use structured bindings
everywhere as it wasn't clear to me it would improve readability.

This is in preparation to the switch to zip semantics which won't
support non-const lvalue reference to elements:
https://reviews.llvm.org/D144503.

Diff Detail

Event Timeline

kuhar created this revision.Mar 13 2023, 1:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 1:39 PM
kuhar requested review of this revision.Mar 13 2023, 1:39 PM
kuhar updated this revision to Diff 504837.Mar 13 2023, 1:44 PM

Also include clang/ since there's only one function to update

Herald added a project: Restricted Project. · View Herald TranscriptMar 13 2023, 1:44 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
dblaikie accepted this revision.Mar 13 2023, 3:34 PM

Looks alright - thanks! :)

llvm/lib/Transforms/Vectorize/SLPVectorizer.cpp
3962

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.

This revision is now accepted and ready to land.Mar 13 2023, 3:34 PM
kuhar updated this revision to Diff 504901.Mar 13 2023, 5:47 PM
kuhar marked an inline comment as done.

Update lambda signature

This revision was landed with ongoing or failed builds.Mar 13 2023, 5:59 PM
This revision was automatically updated to reflect the committed changes.