[llvm] [LV] Ignore user-specified interleave count when unsafe. (PR #153009)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 11 07:35:15 PDT 2025


================
@@ -10201,15 +10204,22 @@ bool LoopVectorizePass::processLoop(Loop *L) {
     VectorizeLoop = false;
   }
 
-  if (!LVP.hasPlanWithVF(VF.Width) && UserIC > 1) {
+  if (UserIC > 0 && UserIC != SafeUserIC) {
+    LLVM_DEBUG(dbgs() << "LV: Disabling interleaving as user-specified "
+                         "interleave count is unsafe.\n");
+    IntDiagMsg = {"InterleavingUnsafe",
----------------
david-arm wrote:

I don't think this is strictly true because on the line above you've set SafeUserIC to 0, and then we have `unsigned SelectedIC = std::max(IC, SafeUserIC);`

It's possible that `selectInterleaveCount` may set IC to > 1 in future based on the maximum safe distance. It might be better to say something more vague like "Ignoring UserIC due to possibly unsafe dependencies in the loop".

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


More information about the llvm-commits mailing list