[llvm] [VPlan] Use BlockFrequencyInfo in getPredBlockCostDivisor (PR #158690)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 02:59:30 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;
----------------
fhahn wrote:

Not sure if it is worth it, but we could avoid repeated (indirect) calls to the lambda if we cache BFI ourselves instead of always going through the lambda + pass manager caching.

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


More information about the llvm-commits mailing list