[PATCH] D52051: [LLD] [COFF] Avoid copying of chunk vectors. NFC.
Martin Storsjö via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 13 12:50:08 PDT 2018
mstorsjo created this revision.
mstorsjo added reviewers: ruiu, rnk, pcc.
When declaring the pair variable as "auto Pair : Map", it is effectively declared as
std::pair<std::pair<StringRef, uint32_t>, std::vector<Chunk *>>.
This effectively does a full, shallow copy of the Chunk vector, just to be thrown away after each iteration.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D52051
Files:
COFF/Writer.cpp
Index: COFF/Writer.cpp
===================================================================
--- COFF/Writer.cpp
+++ COFF/Writer.cpp
@@ -469,7 +469,7 @@
// '$' and all following characters in input section names are
// discarded when determining output section. So, .text$foo
// contributes to .text, for example. See PE/COFF spec 3.2.
- for (auto Pair : Map) {
+ for (auto &Pair : Map) {
StringRef Name = getOutputSectionName(Pair.first.first);
uint32_t OutChars = Pair.first.second;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52051.165356.patch
Type: text/x-patch
Size: 506 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180913/0dd88c90/attachment.bin>
More information about the llvm-commits
mailing list