[llvm] [LLVM][LV] Improve UF calculation for vscale based scalar loops. (PR #146102)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 28 03:14:17 PDT 2025
================
@@ -418,7 +420,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))
+ return ElementCount::getFixed(ExpectedTC);
+
+ const SCEV *BTC = SE->getBackedgeTakenCount(L);
+
+ if (isa<SCEVCouldNotCompute>(BTC))
----------------
fhahn wrote:
nit
```suggestion
const SCEV *BTC = SE->getBackedgeTakenCount(L);
if (isa<SCEVCouldNotCompute>(BTC))
```
https://github.com/llvm/llvm-project/pull/146102
More information about the llvm-commits
mailing list