[llvm] [LV] Improve accuracy of branch weights in epilogue iteration check block (PR #152980)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 03:10:49 PDT 2025


================
@@ -7649,6 +7649,16 @@ EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(
     unsigned MainLoopStep = EPI.MainLoopUF * EPI.MainLoopVF.getKnownMinValue();
     unsigned EpilogueLoopStep =
         EPI.EpilogueUF * EPI.EpilogueVF.getKnownMinValue();
+    // When one of the vector loops is scalable and the other isn't, we can use
+    // the estimated value of vscale to improve the accuracy.
+    if (EPI.MainLoopVF.isScalable() != EPI.EpilogueVF.isScalable()) {
----------------
lukel97 wrote:

Yeah I was thinking that might be a bit simpler since there's less cases to consider, and that means the steps are always in concrete amounts

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


More information about the llvm-commits mailing list