mirror of
https://github.com/intel/llvm.git
synced 2026-01-20 10:58:11 +08:00
[WebAssembly] Avoid COMDAT hashmap lookup for each symbol. NFC
This reduces the number of lookups to one per COMDAT group, rather than one per symbol in a COMDAT group. Differential Revision: https://reviews.llvm.org/D44344 llvm-svn: 327523
This commit is contained in:
@@ -158,6 +158,11 @@ void ObjFile::parse() {
|
||||
TypeMap.resize(getWasmObj()->types().size());
|
||||
TypeIsUsed.resize(getWasmObj()->types().size(), false);
|
||||
|
||||
ArrayRef<StringRef> Comdats = WasmObj->linkingData().Comdats;
|
||||
UsedComdats.resize(Comdats.size());
|
||||
for (unsigned I = 0; I < Comdats.size(); ++I)
|
||||
UsedComdats[I] = Symtab->addComdat(Comdats[I]);
|
||||
|
||||
// Populate `Segments`.
|
||||
for (const WasmSegment &S : WasmObj->dataSegments()) {
|
||||
InputSegment *Seg = make<InputSegment>(S, this);
|
||||
@@ -194,10 +199,10 @@ void ObjFile::parse() {
|
||||
}
|
||||
|
||||
bool ObjFile::isExcludedByComdat(InputChunk *Chunk) const {
|
||||
StringRef S = Chunk->getComdat();
|
||||
if (S.empty())
|
||||
uint32_t C = Chunk->getComdat();
|
||||
if (C == UINT32_MAX)
|
||||
return false;
|
||||
return !Symtab->addComdat(S, this);
|
||||
return !UsedComdats[C];
|
||||
}
|
||||
|
||||
FunctionSymbol *ObjFile::getFunctionSymbol(uint32_t Index) const {
|
||||
|
||||
Reference in New Issue
Block a user