[llvm] [LLVM][LV] Improve UF calculation for vscale based scalar loops. (PR #146102)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 14 08:45:39 PDT 2025
================
@@ -4813,16 +4839,19 @@ LoopVectorizationCostModel::selectInterleaveCount(VPlan &Plan, ElementCount VF,
MaxInterleaveCount = ForceTargetMaxVectorInterleaveFactor;
}
- unsigned EstimatedVF = getEstimatedRuntimeVF(VF, VScaleForTuning);
-
// Try to get the exact trip count, or an estimate based on profiling data or
- // ConstantMax from PSE, failing that.
- if (auto BestKnownTC = getSmallBestKnownTC(PSE, TheLoop)) {
+ // ConstantMax from PSE, failing that. For fixed length VFs treat a scalable
+ // trip count as if unknown.
+ if (auto BestKnownTC = getSmallBestKnownTC(PSE, TheLoop);
----------------
david-arm wrote:
I know this works, but I personally find it more readable to avoid multiple statements separated by `;` within an `if(...)` block, i.e. something like
```
auto BestKnownTC = getSmallBestKnownTC(PSE, TheLoop);
if (BestKnownTC && (BestKnownTC->isFixed() || VF.isScalable())
```
https://github.com/llvm/llvm-project/pull/146102
More information about the llvm-commits
mailing list