Skip to content

[IPO] Avoid repeated hash lookups (NFC) #130546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/lib/Transforms/IPO/LowerTypeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2207,9 +2207,9 @@ bool LowerTypeTestsModule::lower() {
bool IsExported = false;
if (Function *F = dyn_cast<Function>(&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
Expand Down Expand Up @@ -2407,9 +2407,9 @@ bool LowerTypeTestsModule::lower() {
cast<MDString>(AliasMD->getOperand(0))->getString();
StringRef Aliasee = cast<MDString>(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 =
Expand Down