[llvm] [LLVM][LV] Improve UF calculation for vscale based scalar loops. (PR #146102)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 11 06:56:07 PDT 2025


================
@@ -423,7 +423,26 @@ static bool hasIrregularType(Type *Ty, const DataLayout &DL) {
 /// ElementCount to include loops whose trip count is a function of vscale.
 static ElementCount getSmallConstantTripCount(ScalarEvolution *SE,
                                               const Loop *L) {
-  return ElementCount::getFixed(SE->getSmallConstantTripCount(L));
+  if (unsigned ExpectedTC = SE->getSmallConstantTripCount(L))
----------------
paulwalker-arm wrote:

That's the route I started with but was advised to make the function specific to LoopVectorize, presumably until such a time that its applicability extends beyond vectorisation.

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


More information about the llvm-commits mailing list