[llvm] [LoopVectorize] Use predicated version of getSmallConstantMaxTripCount (PR #109928)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 26 01:13:44 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:

Hmm, that's a good question. I'd assumed that when we call PSE.getBackedgeTakenCount(TheLoop, &Predicates) at some point later on to create the trip count, that it would just end up adding the same predicates anyway.

Does it matter if we attempt to add the same predicate twice? If not, then I'm happy to change this and use the predicated version.

https://github.com/llvm/llvm-project/pull/109928


More information about the llvm-commits mailing list