[llvm] [LoopVectorize] Improve Vectorization of Small Loops (PR #195823)

Jack Styles via llvm-commits llvm-commits at lists.llvm.org
Tue May 5 08:47:57 PDT 2026


================
@@ -3012,6 +3012,16 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
   }
 
   auto ExpectedTC = getSmallBestKnownTC(PSE, TheLoop);
+  auto ApplyVectorWidth = [](FixedScalableVFPair &MaxFactors,
+                             unsigned int FixedVF, unsigned int ScalableVF) {
+    MaxFactors.FixedVF = ElementCount::getFixed(FixedVF);
+    MaxFactors.ScalableVF = ElementCount::getScalable(ScalableVF);
+  };
+  unsigned EffectiveIC = UserIC > 0 ? UserIC : 1;
+  auto HasOneScalarIterationRemainder = [EffectiveIC](ElementCount &ExactTC,
+                                                      unsigned int VF) -> bool {
+    return ExactTC.getFixedValue() == ((VF * EffectiveIC) + 1);
----------------
Stylie777 wrote:

Done

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


More information about the llvm-commits mailing list