[PATCH] D133017: [LV] Use SCEV to check if the trip count <= VF * UF.
Ayal Zaks via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 05:26:07 PST 2022
Ayal accepted this revision.
Ayal added a comment.
This revision is now accepted and ready to land.
Looks good to me, thanks.
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:483
Plan.getCanonicalIV()->getStartValue()->getLiveInIRValue()->getType();
const SCEV *ExitCount = createTripCountSCEV(IdxTy, PSE);
ScalarEvolution &SE = *PSE.getSE();
----------------
Thought: create vector trip count SCEV, once VF and UF are set; use it to create vector trip count Value, and also to check if it is known to be less than or equal to 1?
================
Comment at: llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp:469
+ if (ExitCount->isZero() ||
+ !SE.isKnownPredicate(CmpInst::ICMP_ULE, ExitCount, C))
return;
----------------
fhahn wrote:
> Ayal wrote:
> > Could this be simplified using SE.getSmallConstantMaxTripCount(L)? Or a caching thereof.
> `SE.getSmallConstantMaxTripCount(L)` only supports the case where the trip count is a constant, while `isKnownPredicate` supports the non-constant case as well.
Ok. Non-constant case seems a bit extreme, unless tail is folded - vectorizing and unrolling to a known upper bound will otherwise run the original scalar loop whenever its trip count misses the exact upper bound.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133017/new/
https://reviews.llvm.org/D133017
More information about the llvm-commits
mailing list