[llvm] [LV] Consider whether vscale is a known power of two for iteration check (PR #144963)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 20 03:13:42 PDT 2025


================
@@ -2434,7 +2434,7 @@ Value *InnerLoopVectorizer::createIterationCountCheck(ElementCount VF,
       // check is known to be true, or known to be false.
       CheckMinIters = Builder.CreateICmp(P, Count, Step, "min.iters.check");
     } // else step known to be < trip count, use CheckMinIters preset to false.
-  } else if (VF.isScalable() &&
+  } else if (VF.isScalable() && !TTI->isVScaleKnownToBeAPowerOfTwo() &&
----------------
lukel97 wrote:

I just did some checking and I couldn't find any tests that cover this, we should probably add one then.

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


More information about the llvm-commits mailing list