Changeset View
Changeset View
Standalone View
Standalone View
llvm/lib/Analysis/BranchProbabilityInfo.cpp
Show First 20 Lines • Show All 1,062 Lines • ▼ Show 20 Lines | void BranchProbabilityInfo::eraseBlock(const BasicBlock *BB) { | ||||
} | } | ||||
} | } | ||||
void BranchProbabilityInfo::calculate(const Function &F, const LoopInfo &LI, | void BranchProbabilityInfo::calculate(const Function &F, const LoopInfo &LI, | ||||
const TargetLibraryInfo *TLI, | const TargetLibraryInfo *TLI, | ||||
PostDominatorTree *PDT) { | PostDominatorTree *PDT) { | ||||
LLVM_DEBUG(dbgs() << "---- Branch Probability Info : " << F.getName() | LLVM_DEBUG(dbgs() << "---- Branch Probability Info : " << F.getName() | ||||
<< " ----\n\n"); | << " ----\n\n"); | ||||
if (F.empty()) | |||||
fhahn: Are empty functions valid IR? Don't they have to have at least a single BB. And each BB needs… | |||||
weiwangAuthorUnsubmitted This is a special case where function is marked dead and its body is completed strip away. AFAIK, it only happens before LTO backend, so analysis/pass in pass pipeline won't see such function. weiwang: This is a special case where function is marked dead and its body is completed strip away. | |||||
return; | |||||
LastF = &F; // Store the last function we ran on for printing. | LastF = &F; // Store the last function we ran on for printing. | ||||
assert(PostDominatedByUnreachable.empty()); | assert(PostDominatedByUnreachable.empty()); | ||||
assert(PostDominatedByColdCall.empty()); | assert(PostDominatedByColdCall.empty()); | ||||
// Record SCC numbers of blocks in the CFG to identify irreducible loops. | // Record SCC numbers of blocks in the CFG to identify irreducible loops. | ||||
// FIXME: We could only calculate this if the CFG is known to be irreducible | // FIXME: We could only calculate this if the CFG is known to be irreducible | ||||
// (perhaps cache this info in LoopInfo if we can easily calculate it there?). | // (perhaps cache this info in LoopInfo if we can easily calculate it there?). | ||||
int SccNum = 0; | int SccNum = 0; | ||||
▲ Show 20 Lines • Show All 110 Lines • Show Last 20 Lines |
Are empty functions valid IR? Don't they have to have at least a single BB. And each BB needs at least a terminator?