[llvm] [AArch64] Enable RT and partial unrolling with reductions for Apple CPUs. (PR #149699)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 20 04:35:22 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- llvm/include/llvm/Transforms/Utils/UnrollLoop.h llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp llvm/lib/Transforms/Utils/LoopUnroll.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index d4fb60d9c..f6e557e05 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -4788,13 +4788,16 @@ getAppleRuntimeUnrollPreferences(Loop *L, ScalarEvolution &SE,
   if (!L->getExitBlock())
     return;
 
-  // Check if the loop contains any reductions that could be parallelized when unrolling.
-  // If so, enable partial unrolling, if the trip count is know to be a multiple of 2.
+  // Check if the loop contains any reductions that could be parallelized when
+  // unrolling. If so, enable partial unrolling, if the trip count is know to be
+  // a multiple of 2.
   bool HasParellelizableReductions =
       L->getNumBlocks() == 1 &&
-      any_of(L->getHeader()->phis(), [&SE, L](PHINode &Phi) {
-        return canParallelizeReductionWhenUnrolling(Phi, L, &SE);
-      }) && isLoopSizeWithinBudget(L, TTI, 12, nullptr);
+      any_of(L->getHeader()->phis(),
+             [&SE, L](PHINode &Phi) {
+               return canParallelizeReductionWhenUnrolling(Phi, L, &SE);
+             }) &&
+      isLoopSizeWithinBudget(L, TTI, 12, nullptr);
   if (HasParellelizableReductions &&
       SE.getSmallConstantTripMultiple(L, L->getExitingBlock()) % 2 == 0) {
     UP.Partial = true;

``````````

</details>


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


More information about the llvm-commits mailing list