[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


================
@@ -133,7 +138,9 @@ VPBasicBlock *PlainCFGBuilder::getOrCreateVPBB(BasicBlock *BB) {
   // Create new VPBB.
   StringRef Name = BB->getName();
   LLVM_DEBUG(dbgs() << "Creating VPBasicBlock for " << Name << "\n");
-  VPBasicBlock *VPBB = Plan->createVPBasicBlock(Name);
+  VPBasicBlock *VPBB = Plan->createVPBasicBlock(
+      Name, /*Recipe=*/nullptr,
+      GetBranchWeights ? GetBranchWeights(BB) : nullptr);
----------------
lukel97 wrote:

Nit, do we need to pass the branch weights in the constructor? Is it simpler if we just call `setBranchWeights` after construction? 

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


More information about the llvm-commits mailing list