[llvm] [LV] Derive max trip count for remainder loops through LCSSA phis (PR #206887)

Muhammed Shiyas N via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 05:28:58 PDT 2026


================
@@ -2943,6 +3045,21 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
   LLVM_DEBUG(dbgs() << "LV: Found trip count: " << TC << '\n');
   if (TC != ElementCount::getFixed(MaxTC))
     LLVM_DEBUG(dbgs() << "LV: Found maximum trip count: " << MaxTC << '\n');
+
+  // If we derived a small max trip count (e.g. from a remainder-of-stride
----------------
Shiyas-N wrote:

Thanks for the helpful feedback,
I have updated this PR to focus exclusively on deriving MaxTC for remainder loops and letting clampVFByMaxTripCount() clamp the vectorization factor appropriately

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


More information about the llvm-commits mailing list