These functions seem to be unused for at least 5 years.
/// as having a relative probability >= 80%.
bool isEdgeHot(const BasicBlock *Src, const BasicBlock *Dst) const;
- /// Retrieve the hot successor of a block if one exists.
- ///
- /// Given a basic block, look through its successors and if one exists for
- /// which \see isEdgeHot would return true, return that successor block.
- const BasicBlock *getHotSucc(const BasicBlock *BB) const;
-
/// Print an edge's probability.
///
/// Retrieves an edge's probability similarly to \see getEdgeProbability, but
bool isEdgeHot(const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const;
- // Return a hot successor for the block BB or null if there isn't one.
- // NB: This routine's complexity is linear on the number of successors.
- MachineBasicBlock *getHotSucc(MachineBasicBlock *MBB) const;
-
// Print value between 0 (0% probability) and 1 (100% probability),
// however the value is never equal to 0, and can be 1 only iff SRC block
// has only one successor.
return getEdgeProbability(Src, Dst) > BranchProbability(4, 5);
}
-const BasicBlock *
-BranchProbabilityInfo::getHotSucc(const BasicBlock *BB) const {
- auto MaxProb = BranchProbability::getZero();
- const BasicBlock *MaxSucc = nullptr;
-
- for (const auto *Succ : successors(BB)) {
- auto Prob = getEdgeProbability(BB, Succ);
- if (Prob > MaxProb) {
- MaxProb = Prob;
- MaxSucc = Succ;
- }
- }
-
- // Hot probability is at least 4/5 = 80%
- if (MaxProb > BranchProbability(4, 5))
- return MaxSucc;
-
- return nullptr;
-}
-
/// Get the raw edge probability for the edge. If can't find it, return a
/// default probability 1/N where N is the number of successors. Here an edge is
/// specified using PredBlock and an
return getEdgeProbability(Src, Dst) > HotProb;
}
-MachineBasicBlock *
-MachineBranchProbabilityInfo::getHotSucc(MachineBasicBlock *MBB) const {
- auto MaxProb = BranchProbability::getZero();
- MachineBasicBlock *MaxSucc = nullptr;
- for (MachineBasicBlock::const_succ_iterator I = MBB->succ_begin(),
- E = MBB->succ_end(); I != E; ++I) {
- auto Prob = getEdgeProbability(MBB, I);
- if (Prob > MaxProb) {
- MaxProb = Prob;
- MaxSucc = *I;
- }
- }
-
- BranchProbability HotProb(StaticLikelyProb, 100);
- if (getEdgeProbability(MBB, MaxSucc) >= HotProb)
- return MaxSucc;
-
- return nullptr;
-}
-
raw_ostream &MachineBranchProbabilityInfo::printEdgeProbability(
raw_ostream &OS, const MachineBasicBlock *Src,
const MachineBasicBlock *Dst) const {