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

via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 11 04:28:56 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.
----------------
ayalz wrote:

The condition below checks if the trip count is too close to UMax - such that bumping it by step overflows, rather than checking if trip count can be proven to be >= step. Another TODO?

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


More information about the llvm-commits mailing list