[PATCH] D39609: Remove a std::map and std::set that show up in LLD profiles
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 13 10:39:14 PST 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL318072: Remove a std::map and std::set that show up in LLD profiles (authored by rnk).
Changed prior to commit:
https://reviews.llvm.org/D39609?vs=121517&id=122690#toc
Repository:
rL LLVM
https://reviews.llvm.org/D39609
Files:
lld/trunk/COFF/Config.h
lld/trunk/COFF/Driver.cpp
lld/trunk/COFF/Symbols.h
Index: lld/trunk/COFF/Driver.cpp
===================================================================
--- lld/trunk/COFF/Driver.cpp
+++ lld/trunk/COFF/Driver.cpp
@@ -355,7 +355,10 @@
Symbol *LinkerDriver::addUndefined(StringRef Name) {
Symbol *B = Symtab->addUndefined(Name);
- Config->GCRoot.insert(B);
+ if (!B->IsGCRoot) {
+ B->IsGCRoot = true;
+ Config->GCRoot.push_back(B);
+ }
return B;
}
Index: lld/trunk/COFF/Symbols.h
===================================================================
--- lld/trunk/COFF/Symbols.h
+++ lld/trunk/COFF/Symbols.h
@@ -77,7 +77,8 @@
friend SymbolTable;
explicit Symbol(Kind K, StringRef N = "")
: SymbolKind(K), IsExternal(true), IsCOMDAT(false),
- WrittenToSymtab(false), Name(N) {}
+ WrittenToSymtab(false), PendingArchiveLoad(false), IsGCRoot(false),
+ Name(N) {}
const unsigned SymbolKind : 8;
unsigned IsExternal : 1;
@@ -98,6 +99,9 @@
// not load any more archive members to resolve the same symbol.
unsigned PendingArchiveLoad : 1;
+ /// True if we've already added this symbol to the list of GC roots.
+ unsigned IsGCRoot : 1;
+
protected:
StringRef Name;
};
Index: lld/trunk/COFF/Config.h
===================================================================
--- lld/trunk/COFF/Config.h
+++ lld/trunk/COFF/Config.h
@@ -94,7 +94,7 @@
std::vector<llvm::StringRef> Argv;
// Symbols in this set are considered as live by the garbage collector.
- std::set<Symbol *> GCRoot;
+ std::vector<Symbol *> GCRoot;
std::set<StringRef> NoDefaultLibs;
bool NoDefaultLibAll = false;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D39609.122690.patch
Type: text/x-patch
Size: 1606 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171113/72a6df66/attachment.bin>
More information about the llvm-commits
mailing list