[PATCH] D45227: Instead of using std::copy, clear the vector first and add new elements. NFC.
Rui Ueyama via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 3 13:11:44 PDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL329107: Instead of using std::copy, clear the vector first and add new elements. NFC. (authored by ruiu, committed by ).
Changed prior to commit:
https://reviews.llvm.org/D45227?vs=140849&id=140851#toc
Repository:
rL LLVM
https://reviews.llvm.org/D45227
Files:
lld/trunk/ELF/Writer.cpp
Index: lld/trunk/ELF/Writer.cpp
===================================================================
--- lld/trunk/ELF/Writer.cpp
+++ lld/trunk/ELF/Writer.cpp
@@ -1137,24 +1137,23 @@
// of the second block of cold code can call the hot code without a thunk. So
// we effectively double the amount of code that could potentially call into
// the hot code without a thunk.
- size_t UnorderedInsPt = 0;
+ size_t InsPt = 0;
if (Target->ThunkSectionSpacing && !OrderedSections.empty()) {
uint64_t UnorderedPos = 0;
- for (; UnorderedInsPt != UnorderedSections.size(); ++UnorderedInsPt) {
- UnorderedPos += UnorderedSections[UnorderedInsPt]->getSize();
+ for (; InsPt != UnorderedSections.size(); ++InsPt) {
+ UnorderedPos += UnorderedSections[InsPt]->getSize();
if (UnorderedPos > UnorderedSize / 2)
break;
}
}
- std::copy(UnorderedSections.begin(),
- UnorderedSections.begin() + UnorderedInsPt, ISD->Sections.begin());
- std::vector<InputSection *>::iterator SectionsPos =
- ISD->Sections.begin() + UnorderedInsPt;
+ ISD->Sections.clear();
+ for (InputSection *IS : makeArrayRef(UnorderedSections).slice(0, InsPt))
+ ISD->Sections.push_back(IS);
for (std::pair<InputSection *, int> P : OrderedSections)
- *SectionsPos++ = P.first;
- std::copy(UnorderedSections.begin() + UnorderedInsPt, UnorderedSections.end(),
- SectionsPos);
+ ISD->Sections.push_back(P.first);
+ for (InputSection *IS : makeArrayRef(UnorderedSections).slice(InsPt))
+ ISD->Sections.push_back(IS);
}
static void sortSection(OutputSection *Sec,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D45227.140851.patch
Type: text/x-patch
Size: 1621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180403/3f91009e/attachment-0001.bin>
More information about the llvm-commits
mailing list