[llvm] [VPlan] Preserve branch weights from VPlan0 through to codegen. (PR #213143)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 31 01:03:20 PDT 2026


lukel97 wrote:

> > I think this makes sense, agree that storing the metadata on the terminators is the way to go.
> > Re: #196845, I guess we would need to then implement a sort of BlockFrequencyInfo analysis at the VPlan level to recover the block frequencies from the branch weights. But I don't think it needs to be overly complicated (famous last words)
> 
> The follow-up commit right now uses the existin BFI to add branch-weights up-front, and it should not need any other changes [db3795b](https://github.com/llvm/llvm-project/commit/db3795be32b0364edb390f2ef795110a7f66d1ec).
> 
> With that we match the results of the IR based BFI queries in the cost model.

I think the VPlan-level-BFI I was thinking of is actually just `vputils::computeBlockProbabilities`, I didn't notice you had already implemented it in this PR.

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


More information about the llvm-commits mailing list