[llvm] [LoopVectorize] Use predicated version of getSmallConstantMaxTripCount (PR #109928)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 27 07:09:51 PDT 2024
================
@@ -3994,8 +3996,13 @@ LoopVectorizationCostModel::computeMaxVF(ElementCount UserVF, unsigned UserIC) {
}
unsigned TC = PSE.getSE()->getSmallConstantTripCount(TheLoop);
- unsigned MaxTC = PSE.getSE()->getSmallConstantMaxTripCount(TheLoop);
+
+ SmallVector<const SCEVPredicate *, 2> Predicates;
+ unsigned MaxTC =
+ PSE.getSE()->getSmallConstantMaxTripCount(TheLoop, &Predicates);
----------------
david-arm wrote:
I think it's safe to add the predicates multiple times, since the `addPredicate` function in PredicatedScalarEvolution already checks to see if the new predicate is already implied by its existing list. I've added a new `getSmallConstantMaxTripCount` to PredicatedScalarEvolution and kept track of the count to avoid unnecessary computation, similar to how we return the backedge taken count.
https://github.com/llvm/llvm-project/pull/109928
More information about the llvm-commits
mailing list