[llvm] [LV] Use SCEV to check if minimum iteration check is known. (PR #111310)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 15 06:31:43 PDT 2024
================
@@ -2454,8 +2471,16 @@ 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.
+ const SCEV *TripCountSCEV = SE.applyLoopGuards(SE.getSCEV(LHS), OrigLoop);
----------------
david-arm wrote:
Does this have any side-effects, i.e. change the existing IR in any way? If not, everything from lines 2475-2481 are entirely related to the assert. Perhaps wrap it in a `#ifndef NDEBUG`?
https://github.com/llvm/llvm-project/pull/111310
More information about the llvm-commits
mailing list