Skip to content

Commit

Permalink
[WasmExceptionInfo] Use SmallPtrSet::remove_if() (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 26, 2024
1 parent b6a94b6 commit 519dbc6
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions llvm/lib/Target/WebAssembly/WebAssemblyExceptionInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,12 @@ void WebAssemblyExceptionInfo::recalculate(
auto *SrcWE = P.first;
auto *DstWE = P.second;

for (auto *MBB : SrcWE->getBlocksSet()) {
SrcWE->getBlocksSet().remove_if([&](MachineBasicBlock *MBB){
if (MBB->isEHPad()) {
assert(!isReachableAmongDominated(DstWE->getEHPad(), MBB,
SrcWE->getEHPad(), MDT) &&
"We already handled EH pads above");
continue;
return false;
}
if (isReachableAmongDominated(DstWE->getEHPad(), MBB, SrcWE->getEHPad(),
MDT)) {
Expand All @@ -227,15 +227,16 @@ void WebAssemblyExceptionInfo::recalculate(
InnerWE->removeFromBlocksSet(MBB);
InnerWE = InnerWE->getParentException();
}
SrcWE->removeFromBlocksSet(MBB);
LLVM_DEBUG(dbgs() << " removed from " << SrcWE->getEHPad()->getNumber()
<< "." << SrcWE->getEHPad()->getName()
<< "'s exception\n");
changeExceptionFor(MBB, SrcWE->getParentException());
if (SrcWE->getParentException())
SrcWE->getParentException()->addToBlocksSet(MBB);
return true;
}
}
return false;
});
}

// Add BBs to exceptions' block vector
Expand Down

0 comments on commit 519dbc6

Please sign in to comment.