[llvm] [LV] Use original trip-count as the vector-trip-count if use predicated EVL instructions for tail-folding. (PR #132675)

Pengcheng Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 24 00:57:23 PDT 2025


================
@@ -2426,9 +2426,19 @@ InnerLoopVectorizer::getOrCreateVectorTripCount(BasicBlock *InsertBlock) {
     return VectorTripCount;
 
   Value *TC = getTripCount();
+  Type *Ty = TC->getType();
   IRBuilder<> Builder(InsertBlock->getTerminator());
 
-  Type *Ty = TC->getType();
+  // Use original trip count as the vector trip count if use predicated EVL
+  // instructions for tail-folding.
+  if (VF.isVector() &&
+      Cost->getTailFoldingStyle() == TailFoldingStyle::DataWithEVL) {
----------------
wangpc-pp wrote:

Use `Cost->foldTailWithEVL()`?

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


More information about the llvm-commits mailing list