[WebAssembly] Optimize Writer::lookupType

Followup on https://reviews.llvm.org/D41894

llvm-svn: 322219
This commit is contained in:
Sam Clegg 2018-01-10 20:12:26 +00:00
parent 70f137b6bf
commit 8d027d6758
1 changed files with 5 additions and 2 deletions

View File

@ -571,9 +571,12 @@ void Writer::calculateImports() {
}
uint32_t Writer::lookupType(const WasmSignature &Sig) {
if (TypeIndices.count(Sig) == 0)
auto It = TypeIndices.find(Sig);
if (It == TypeIndices.end()) {
error("type not found: " + toString(Sig));
return TypeIndices.lookup(Sig);
return 0;
}
return It->second;
}
uint32_t Writer::registerType(const WasmSignature &Sig) {