Skip to content

[CodeGen] Avoid repeated hash lookups (NFC) #124885

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
6 changes: 4 additions & 2 deletions llvm/lib/CodeGen/WinEHPrepare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,8 @@ void llvm::calculateCXXStateForAsynchEH(const BasicBlock *BB, int State,
const BasicBlock *BB = WI->Block;
int State = WI->State;
delete WI;
if (EHInfo.BlockToStateMap.count(BB) && EHInfo.BlockToStateMap[BB] <= State)
if (auto It = EHInfo.BlockToStateMap.find(BB);
It != EHInfo.BlockToStateMap.end() && It->second <= State)
continue; // skip blocks already visited by lower State

BasicBlock::const_iterator It = BB->getFirstNonPHIIt();
Expand Down Expand Up @@ -312,7 +313,8 @@ void llvm::calculateSEHStateForAsynchEH(const BasicBlock *BB, int State,
const BasicBlock *BB = WI->Block;
int State = WI->State;
delete WI;
if (EHInfo.BlockToStateMap.count(BB) && EHInfo.BlockToStateMap[BB] <= State)
if (auto It = EHInfo.BlockToStateMap.find(BB);
It != EHInfo.BlockToStateMap.end() && It->second <= State)
continue; // skip blocks already visited by lower State

BasicBlock::const_iterator It = BB->getFirstNonPHIIt();
Expand Down