[llvm] [LV] Always try to use fixed VF for low TC loops if no epilogue allowed. (PR #226318)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 25 11:00:04 PDT 2026
================
@@ -7813,8 +7812,12 @@ bool LoopVectorizePass::processLoop(Loop *L) {
// `CM_EpilogueNotAllowedLowTripLoop` prevents vectorizing loops
// with runtime checks. It's more effective to let
// `isOutsideLoopWorkProfitable` determine if vectorization is
- // beneficial for the loop.
- if (SEL != CM_EpilogueNotNeededFoldTail)
+ // beneficial for the loop. If the trip count is below the target's
+ // minimum for tail-folding, the tail cannot be folded, so treat it like
+ // any other low trip count loop.
+ if (SEL != CM_EpilogueNotNeededFoldTail ||
----------------
fhahn wrote:
Both changes are needed for the test changes. Without that,`SEL` is incorrectly set to `CM_EpilogueNotNeededFoldTail` and the logic around line 3062 does not trigger. Alternatively we could check both, but it seems cleaner to not set to `CM_EpilogueNotNeededFoldTail` when tail folding is not allowed for the trip count
https://github.com/llvm/llvm-project/pull/226318
More information about the llvm-commits
mailing list