[llvm] [Analysis][NFC] Use block numbers for BranchProbabilityInfo (PR #186658)

Alexis Engelke via llvm-commits llvm-commits at lists.llvm.org
Sun Mar 15 11:42:45 PDT 2026


================
@@ -1361,14 +1378,15 @@ BranchProbabilityInfo::getEdgeProbability(const BasicBlock *Src,
 void BranchProbabilityInfo::setEdgeProbability(
     const BasicBlock *Src, const SmallVectorImpl<BranchProbability> &Probs) {
   assert(Src->getTerminator()->getNumSuccessors() == Probs.size());
-  eraseBlock(Src); // Erase stale data if any.
-  if (Probs.size() == 0)
-    return; // Nothing to set.
+  if (Probs.empty()) {
+    eraseBlock(Src);
+    return;
+  }
----------------
aengelke wrote:

I wanted to do that at first, but then the assertion below fails... moved check below, but we can't remove it.

https://github.com/llvm/llvm-project/pull/186658


More information about the llvm-commits mailing list