[llvm] [VPlan] Thread branch weights into VPlan and use them for cost (NFCI) (PR #209309)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 00:11:15 PDT 2026


================
@@ -4410,6 +4415,13 @@ class LLVM_ABI_FOR_TEST VPBasicBlock : public VPBlockBase {
   /// Returns a reference to the list of recipes.
   RecipeListTy &getRecipeList() { return Recipes; }
 
+  /// Returns the estimated branch_weights for this block, or null if none.
+  MDNode *getBranchWeights() const { return BranchWeights; }
+
+  /// Records the estimated branch_weights for this block. See \ref
+  /// BranchWeights.
+  void setBranchWeights(MDNode *BW) { BranchWeights = BW; }
----------------
lukel97 wrote:

Should this be named `setBlockProbability`? These aren't really branch weights, since they're computed from the block frequency. And it's possible for a block without a branch to have a probability

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


More information about the llvm-commits mailing list