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

Philip Reames via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 12:02:42 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))
----------------
preames wrote:

This routine seems like it should live on SCEV itself.  I was originally going to propose we change getSmallConstantTripCount to return ElementCount, but that looks mildly invasive.  Maybe for the moment have a "getSmallConstantTripElementCount"?  Not a huge fan of that name, but it's at least close...

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


More information about the llvm-commits mailing list