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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 1 02:59:28 PST 2025


================
@@ -2886,6 +2884,23 @@ bool LoopVectorizationCostModel::isPredicatedInst(Instruction *I) const {
   }
 }
 
+unsigned LoopVectorizationCostModel::getPredBlockCostDivisor(
+    TargetTransformInfo::TargetCostKind CostKind, const BasicBlock *BB) const {
+  // If the block wasn't originally predicated then return early to avoid
+  // computing BlockFrequencyInfo unnecessarily.
+  if (!Legal->blockNeedsPredication(BB))
+    return 1;
+  if (CostKind == TTI::TCK_CodeSize)
----------------
fhahn wrote:

can move cheaper check first

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


More information about the llvm-commits mailing list