[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
Wed Oct 16 00:25:22 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);
----------------
fhahn wrote:
It shouldn't have any side-effects (it may lead to a SCEV being cached for `LHS`, but that shouldn't impact anything unless there's a bug in SCEV invalidation).
Wrapped everything related in `#ifndef NDEBUG`, thanks!
https://github.com/llvm/llvm-project/pull/111310
More information about the llvm-commits
mailing list