[llvm] [AArch64] Unrolling of loops with vector instructions. (PR #147420)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 9 05:00:01 PDT 2025


================
@@ -4872,15 +4872,15 @@ void AArch64TTIImpl::getUnrollingPreferences(
   // Disable partial & runtime unrolling on -Os.
   UP.PartialOptSizeThreshold = 0;
 
+  // No need to unroll auto-vectorized loops that were interleaved
+  if (findStringMetadataForLoop(L, "llvm.loop.isvectorized") &&
+      findStringMetadataForLoop(L, "llvm.loop.interleave.count"))
+    return;
----------------
fhahn wrote:

I think we also need a test to cover this code path, i.e. one where the loop has vector code and the metadata set.

Why do we check if it has an interleave count set? If the loop vectorizer decided to avoid interleaving, we should not unroll I think, as the cost model in LoopUnroll is much simpler than in the loop vectorizer.

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


More information about the llvm-commits mailing list