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);
}