[llvm] [LV] Support tail-folded epilogue loops (PR #208764)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 1 08:59:29 PDT 2026


================
@@ -3034,6 +3034,9 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
       MaxPowerOf2RuntimeVF = std::nullopt; // Stick with tail-folding for now.
   }
 
+  // TODO: Make NoScalarEpilogueNeeded lambda a separate function to be used
+  // only for main loop VF not also epilogueVF. Using it for epilogueVF against
+  // full TC is inaccurate.
----------------
david-arm wrote:

Is there a way to tell if we're doing this for the main loop or the epilogue? If so, it might be better to just always return false if we're calling `computeMaxVF` for the epilogue.

Is there a test for this particular case when forcing epilogue tail-folding? If not, I think it would be good to add one so we can see what happens today. It's hard to tell if we'll actually generate a miscompile here or not.

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


More information about the llvm-commits mailing list