[llvm] [LV] codegen for tail-folded epilogue loop (PR #208764)

Hassnaa Hamdi via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 12 05:59:12 PDT 2026


================
@@ -5788,7 +5846,7 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
 
 InstructionCost LoopVectorizationPlanner::cost(VPlan &Plan, ElementCount VF,
                                                VPRegisterUsage *RU) const {
-  VPCostContext CostCtx(*TLI, Plan, CM, Config,
+  VPCostContext CostCtx(*TLI, Plan, *EnabledCM, Config,
----------------
hassnaaHamdi wrote:

Yes, that's true, but the CM is used later in places that should be related to the epilogue. For example, in `executePlan()` we check `CM->ValuesToIgnore` and `CM->maskPartialAliasing()`. Using the wrong CM there might not affect current behaviour, but the CM being used still isn't the one meant for the epilogue. There could also be other indirect references through function calls.

So reverting the `EnabledCM` changes wouldn't break anything right now, but it's safer to keep it.

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


More information about the llvm-commits mailing list