Skip to content

Commit 1019c24

Browse files
author
git apple-llvm automerger
committed
Merge commit 'af922cf9f7e7' from llvm.org/main into next
2 parents 6822ce6 + af922cf commit 1019c24

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/WinEHPrepare.cpp

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

258258
BasicBlock::const_iterator It = BB->getFirstNonPHIIt();
259259
const llvm::Instruction *TI = BB->getTerminator();
260260
if (It->isEHPad())
261261
State = EHInfo.EHPadStateMap[&*It];
262-
EHInfo.BlockToStateMap[BB] = State; // Record state, also flag visiting
262+
StateIt->second = State; // Record state, also flag visiting
263263

264264
if ((isa<CleanupReturnInst>(TI) || isa<CatchReturnInst>(TI)) && State > 0) {
265265
// Retrive the new State

0 commit comments

Comments
 (0)