[llvm] [LV] Consider UserIC when limiting VF. (PR #174573)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 9 03:17:56 PST 2026


================
@@ -3807,16 +3811,24 @@ ElementCount LoopVectorizationCostModel::clampVFByMaxTripCount(
   if (MaxTripCount > 0 && requiresScalarEpilogue(true))
     MaxTripCount -= 1;
 
-  if (MaxTripCount && MaxTripCount <= EstimatedVF &&
+  // When the user specifies an interleave count, we need to ensure that
+  // VF * UserIC <= MaxTripCount to avoid a dead vector loop.
+  unsigned IC = UserIC > 0 ? UserIC : 1;
+  unsigned EstimatedVFTimesIC = EstimatedVF * IC;
----------------
david-arm wrote:

Do you know what happens when the user specifies both a UserVF and a UserIC that is known at compile time to lead to a dead vector loop? Is there a test for this?

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


More information about the llvm-commits mailing list