Skip to content

Commit 8baa0d9

Browse files
[CodeGen] Avoid repeated hash lookups (NFC) (#124885)
1 parent 8e4c5cb commit 8baa0d9

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

llvm/lib/CodeGen/WinEHPrepare.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,8 @@ void llvm::calculateCXXStateForAsynchEH(const BasicBlock *BB, int State,
251251
const BasicBlock *BB = WI->Block;
252252
int State = WI->State;
253253
delete WI;
254-
if (EHInfo.BlockToStateMap.count(BB) && EHInfo.BlockToStateMap[BB] <= State)
254+
if (auto It = EHInfo.BlockToStateMap.find(BB);
255+
It != EHInfo.BlockToStateMap.end() && It->second <= State)
255256
continue; // skip blocks already visited by lower State
256257

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

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

0 commit comments

Comments
 (0)