[llvm] [VPlan] Record execution frequencies on VPlan0. (PR #222337)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 10 04:10:56 PDT 2026


================
@@ -418,19 +416,17 @@ void VPlanTransforms::introduceMasksAndLinearize(VPlan &Plan) {
       Predicator.createBlockInMask(VPBB);
 
     VPValue *BlockMask = Predicator.getBlockInMask(VPBB);
-    if (!BlockMask)
-      continue;
-
-    // Mask all VPInstructions in the block and record the frequency with
-    // which the masked recipes execute.
-    std::optional<VPExecutionFrequency> Freq = Frequencies.lookup(VPBB);
+    // Mask all VPInstructions in the block. The execution frequency recorded
+    // during VPlan0 construction only stays meaningful for recipes that remain
+    // predicated once the CFG is linearized below; drop it from the others.
----------------
lukel97 wrote:

Dropping the frequencies on unmasked blocks is an optimisation, not a correctness thing right? Could the wording clarify this 
```suggestion
    // Mask all VPInstructions in the block. Drop execution frequency on unmasked instructions since it won't be used.
```

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


More information about the llvm-commits mailing list