[PATCH] D41894: [WebAssembly] Add seperate Writer::lookupType and Writer::registerType. NFC

Sam Clegg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 12:14:23 PST 2018


sbc100 added inline comments.


================
Comment at: lld/trunk/wasm/Writer.cpp:574-576
+  if (TypeIndices.count(Sig) == 0)
+    error("type not found: " + toString(Sig));
+  return TypeIndices.lookup(Sig);
----------------
ruiu wrote:
>   auto It = TypeIndices.find(Sig);
>   if (It == TypeIndices.end()) {
>     error(...);
>     return 0;
>   }
>   return *It;
> 
> is faster because it looks up the hash table only once.
Fixed in followup CL:  rL322219


Repository:
  rL LLVM

https://reviews.llvm.org/D41894





More information about the llvm-commits mailing list