[llvm] [LV] Use SCEV to check if minimum iteration check is known. (PR #111310)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Oct 13 13:29:15 PDT 2024


================
@@ -2455,8 +2471,17 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
         ConstantInt::get(CountTy, cast<IntegerType>(CountTy)->getMask());
     Value *LHS = Builder.CreateSub(MaxUIntTripCount, Count);
 
+    Value *Step = CreateStep();
+    ScalarEvolution &SE = *PSE.getSE();
+    // Check if we can prove that the trip count is >= the step.
+    // TODO: Emit unconditional branch to vector preheader instead of
+    // conditional branch with known condition.
----------------
fhahn wrote:

Dropped, thanks!

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


More information about the llvm-commits mailing list