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

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 10 11:24:03 PST 2018


ruiu 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);
----------------
  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.


Repository:
  rL LLVM

https://reviews.llvm.org/D41894





More information about the llvm-commits mailing list