uint32_t N = getEdgeWeight(Src, IndexInSuccessors);
uint32_t D = getSumForBlock(Src);
+ // It is possible that the edge weight on the only successor edge of Src is
+ // zero, in which case we return 100%.
+ if (N == 0 && D == 0)
+ return BranchProbability::getOne();
+
return BranchProbability(N, D);
}
uint32_t N = getEdgeWeight(Src, Dst);
uint32_t D = getSumForBlock(Src);
+ // It is possible that the edge weight on the only successor edge of Src is
+ // zero, in which case we return 100%.
+ if (N == 0 && D == 0)
+ return BranchProbability::getOne();
+
return BranchProbability(N, D);
}
+BranchProbability
+BranchProbabilityInfo::getEdgeProbability(const BasicBlock *Src,
+ succ_const_iterator Dst) const {
+ return getEdgeProbability(Src, Dst.getSuccessorIndex());
+}
+
raw_ostream &
BranchProbabilityInfo::printEdgeProbability(raw_ostream &OS,
const BasicBlock *Src,