Skip to content

[BPI] Use BasicBlock::isEHPad() to check exception handling block. #95771

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
merged 3 commits into from
Jun 24, 2024
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
9 changes: 3 additions & 6 deletions llvm/lib/Analysis/BranchProbabilityInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -787,12 +787,9 @@ BranchProbabilityInfo::getInitialEstimatedBlockWeight(const BasicBlock *BB) {
? static_cast<uint32_t>(BlockExecWeight::NORETURN)
: static_cast<uint32_t>(BlockExecWeight::UNREACHABLE);

// Check if the block is 'unwind' handler of some invoke instruction.
for (const auto *Pred : predecessors(BB))
if (Pred)
if (const auto *II = dyn_cast<InvokeInst>(Pred->getTerminator()))
if (II->getUnwindDest() == BB)
return static_cast<uint32_t>(BlockExecWeight::UNWIND);
// Check if the block is an exception handling block.
if (BB->isEHPad())
return static_cast<uint32_t>(BlockExecWeight::UNWIND);

// Check if the block contains 'cold' call.
for (const auto &I : *BB)
Expand Down
Loading