[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 9 06:15:04 PDT 2024
================
@@ -2438,12 +2438,21 @@ void InnerLoopVectorizer::emitIterationCountCheck(BasicBlock *Bypass) {
};
TailFoldingStyle Style = Cost->getTailFoldingStyle();
- if (Style == TailFoldingStyle::None)
- CheckMinIters =
- Builder.CreateICmp(P, Count, CreateStep(), "min.iters.check");
- else if (VF.isScalable() &&
- !isIndvarOverflowCheckKnownFalse(Cost, VF, UF) &&
- Style != TailFoldingStyle::DataAndControlFlowWithoutRuntimeCheck) {
+ if (Style == TailFoldingStyle::None) {
+ Value *Step = CreateStep();
+ ScalarEvolution &SE = *PSE.getSE();
+ // Check if we can prove that the trip count is >= the step.
+ const SCEV *TripCountSCEV = SE.getTripCountFromExitCount(
+ PSE.getBackedgeTakenCount(), CountTy, OrigLoop);
----------------
ayalz wrote:
Could this be simplified into (P)SE.getSCEV(Count)?
https://github.com/llvm/llvm-project/pull/111310
More information about the llvm-commits
mailing list