[llvm] [VPlan] Use BlockFrequencyInfo in getPredBlockCostDivisor (PR #158690)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 1 03:41:59 PST 2025
================
@@ -1729,6 +1722,11 @@ class LoopVectorizationCostModel {
/// Interface to emit optimization remarks.
OptimizationRemarkEmitter *ORE;
+ /// A function to lazily fetch BlockFrequencyInfo. This avoids computing it
+ /// unless necessary, e.g. when the loop isn't legal to vectorize or when
+ /// there is no predication.
+ std::function<BlockFrequencyInfo *()> GetBFI;
----------------
lukel97 wrote:
We would also need to plumb through the FunctionAnalysisManager to fetch the BFI, which doesn't seem right. Although I took a look at what other passes do e.g. FunctionSpecialization.cpp and they also seem to just pass through a std::function, albeit they return a reference. So I've updated it return a reference too in 296797f804bc48c34ba23e3ffbc2ef2bdd6e451d
https://github.com/llvm/llvm-project/pull/158690
More information about the llvm-commits
mailing list