Skip to content

Commit

Permalink
[BranchProbabilityInfo] Use predecessors(BB) and successors(BB) (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazutakahirata committed Nov 16, 2020
1 parent 43a6a1e commit c5cc2d8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions llvm/lib/Analysis/BranchProbabilityInfo.cpp
Expand Up @@ -220,17 +220,16 @@ void BranchProbabilityInfo::SccInfo::calculateSccBlockType(const BasicBlock *BB,
assert(getSCCNum(BB) == SccNum);
uint32_t BlockType = Inner;

if (llvm::any_of(make_range(pred_begin(BB), pred_end(BB)),
[&](const BasicBlock *Pred) {
if (llvm::any_of(predecessors(BB), [&](const BasicBlock *Pred) {
// Consider any block that is an entry point to the SCC as
// a header.
return getSCCNum(Pred) != SccNum;
}))
BlockType |= Header;

if (llvm::any_of(
make_range(succ_begin(BB), succ_end(BB)),
[&](const BasicBlock *Succ) { return getSCCNum(Succ) != SccNum; }))
if (llvm::any_of(successors(BB), [&](const BasicBlock *Succ) {
return getSCCNum(Succ) != SccNum;
}))
BlockType |= Exiting;

// Lazily compute the set of headers for a given SCC and cache the results
Expand Down

0 comments on commit c5cc2d8

Please sign in to comment.