[llvm] [LV] Use SCEV to check if minimum iteration check is known. (PR #111310)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 16 12:04:29 PDT 2024
================
@@ -2453,8 +2470,17 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
ConstantInt::get(CountTy, cast<IntegerType>(CountTy)->getMask());
Value *LHS = Builder.CreateSub(MaxUIntTripCount, Count);
+ Value *Step = CreateStep();
+#ifndef NDEBUG
+ ScalarEvolution &SE = *PSE.getSE();
+ const SCEV *TripCountSCEV = SE.applyLoopGuards(SE.getSCEV(LHS), OrigLoop);
----------------
ayalz wrote:
```suggestion
const SCEV *TC2OverflowSCEV = SE.applyLoopGuards(SE.getSCEV(LHS), OrigLoop);
```
or something like that, to denote SCEV of "LHS" (UMax - count), distance of Trip Count to overflow, rather than that of trip count itself.
https://github.com/llvm/llvm-project/pull/111310
More information about the llvm-commits
mailing list