Skip to content

Commit 73beb15

Browse files
[MC] Avoid repeated hash lookups (NFC) (#123698)
1 parent 26b87aa commit 73beb15

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/MC/WasmObjectWriter.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,10 +746,11 @@ static void addData(SmallVectorImpl<char> &DataBytes,
746746
uint32_t
747747
WasmObjectWriter::getRelocationIndexValue(const WasmRelocationEntry &RelEntry) {
748748
if (RelEntry.Type == wasm::R_WASM_TYPE_INDEX_LEB) {
749-
if (!TypeIndices.count(RelEntry.Symbol))
749+
auto It = TypeIndices.find(RelEntry.Symbol);
750+
if (It == TypeIndices.end())
750751
report_fatal_error("symbol not found in type index space: " +
751752
RelEntry.Symbol->getName());
752-
return TypeIndices[RelEntry.Symbol];
753+
return It->second;
753754
}
754755

755756
return RelEntry.Symbol->getIndex();

0 commit comments

Comments
 (0)