[llvm] [LoopVectorize] In LoopVectorize.cpp start using getSymbolicMaxBackedgeTakenCount (PR #108833)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 27 07:24:48 PDT 2024


================
@@ -4075,7 +4075,12 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
     unsigned MaxVFtimesIC =
         UserIC ? *MaxPowerOf2RuntimeVF * UserIC : *MaxPowerOf2RuntimeVF;
     ScalarEvolution *SE = PSE.getSE();
-    const SCEV *BackedgeTakenCount = PSE.getBackedgeTakenCount();
+    // Currently only loops with countable exits are vectorized so it's safe to
+    // use getSymbolicMaxBackedgeTakenCount as it should give the same result
+    // as getBackedgeTakenCount.
----------------
paulwalker-arm wrote:

To me the comment suggests when uncountable exists are support calling `getSymbolicMaxBackedgeTakenCount` becomes unsafe?, which I think is the opposite of what you mean.

Perhaps something akin to:

Currently only loops with countable exits are vectorized, but calling `getSymbolicMaxBackedgeTakenCount` allows enablement work for loops with uncountable exits whilst also ensuring the symbolic maximum and known back-edge taken count remain identical for loops with countable exits.

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


More information about the llvm-commits mailing list