From af30016e197a7a9a90f0f5d6140cdc3cb2c7c127 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Sun, 9 Mar 2025 00:56:02 -0800 Subject: [PATCH] [IPO] Avoid repeated hash lookups (NFC) --- llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index 7fe0de19f0256..596a3c1f01f64 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -2207,9 +2207,9 @@ bool LowerTypeTestsModule::lower() { bool IsExported = false; if (Function *F = dyn_cast(&GO)) { IsJumpTableCanonical = isJumpTableCanonical(F); - if (ExportedFunctions.count(F->getName())) { - IsJumpTableCanonical |= - ExportedFunctions[F->getName()].Linkage == CFL_Definition; + if (auto It = ExportedFunctions.find(F->getName()); + It != ExportedFunctions.end()) { + IsJumpTableCanonical |= It->second.Linkage == CFL_Definition; IsExported = true; // TODO: The logic here checks only that the function is address taken, // not that the address takers are live. This can be updated to check @@ -2407,9 +2407,9 @@ bool LowerTypeTestsModule::lower() { cast(AliasMD->getOperand(0))->getString(); StringRef Aliasee = cast(AliasMD->getOperand(1))->getString(); - if (!ExportedFunctions.count(Aliasee) || - ExportedFunctions[Aliasee].Linkage != CFL_Definition || - !M.getNamedAlias(Aliasee)) + if (auto It = ExportedFunctions.find(Aliasee); + It == ExportedFunctions.end() || + It->second.Linkage != CFL_Definition || !M.getNamedAlias(Aliasee)) continue; GlobalValue::VisibilityTypes Visibility =