[llvm] [AArch64] Enable unrolling for small multi-exit loops (PR #131998)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 8 10:55:12 PDT 2025


================
@@ -4687,6 +4746,16 @@ void AArch64TTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
   // Disable partial & runtime unrolling on -Os.
   UP.PartialOptSizeThreshold = 0;
 
+  // Scan the loop: don't unroll loops with calls as this could prevent
+  // inlining. Don't unroll vector loops either, as they don't benefit much from
+  // unrolling.
+  for (auto *BB : L->getBlocks()) {
+    for (auto &I : *BB) {
+      if (!shouldUnrollLoopWithInstruction(I, *this))
----------------
fhahn wrote:

nit: now that this has a single user, could be inlined again

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


More information about the llvm-commits mailing list