forked from OSchip/llvm-project
[WebAssembly] Remove premature optimization.
I think calling reserve() for each object file is too many and isn't useful. We can add reserve() later. By default, we shouldn't add reserve() to a lot of places. Differential Revision: https://reviews.llvm.org/D43722 llvm-svn: 326273
This commit is contained in:
parent
bb333c26ed
commit
da69b711c9
|
@ -895,11 +895,11 @@ void Writer::createCtorFunction() {
|
|||
void Writer::calculateInitFunctions() {
|
||||
for (ObjFile *File : Symtab->ObjectFiles) {
|
||||
const WasmLinkingData &L = File->getWasmObj()->linkingData();
|
||||
InitFunctions.reserve(InitFunctions.size() + L.InitFunctions.size());
|
||||
for (const WasmInitFunc &F : L.InitFunctions)
|
||||
InitFunctions.emplace_back(
|
||||
WasmInitEntry{File->getFunctionSymbol(F.Symbol), F.Priority});
|
||||
}
|
||||
|
||||
// Sort in order of priority (lowest first) so that they are called
|
||||
// in the correct order.
|
||||
std::stable_sort(InitFunctions.begin(), InitFunctions.end(),
|
||||
|
|
Loading…
Reference in New Issue