aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/LoopUnroll.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2025-09-09 14:23:30 +0100
committerGitHub <noreply@github.com>2025-09-09 13:23:30 +0000
commit3ea089ba197681aa3ccbb7325872c58e2eb542e1 (patch)
tree17f982ce495b8928b777dad7265411d9b554dac5 /llvm/lib/Transforms/Utils/LoopUnroll.cpp
parent86b1e1b9720ed4cd892d18503667ab32b080a528 (diff)
downloadllvm-3ea089ba197681aa3ccbb7325872c58e2eb542e1.zip
llvm-3ea089ba197681aa3ccbb7325872c58e2eb542e1.tar.gz
llvm-3ea089ba197681aa3ccbb7325872c58e2eb542e1.tar.bz2
[AArch64] Enable RT and partial unrolling with reductions for Apple CPUs. (#149699)
Update unrolling preferences for Apple Silicon CPUs to enable partial unrolling and runtime unrolling for small loops with reductions. This builds on top of unroller changes to introduce parallel reduction phis, if possible: https://github.com/llvm/llvm-project/pull/149470. PR: https://github.com/llvm/llvm-project/pull/149699
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnroll.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/LoopUnroll.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnroll.cpp b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
index 8a6c778..b18acea 100644
--- a/llvm/lib/Transforms/Utils/LoopUnroll.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnroll.cpp
@@ -671,8 +671,10 @@ llvm::UnrollLoop(Loop *L, UnrollLoopOptions ULO, LoopInfo *LI,
// to not exit.
DenseMap<PHINode *, RecurrenceDescriptor> Reductions;
bool CanAddAdditionalAccumulators =
- UnrollAddParallelReductions && !CompletelyUnroll &&
- L->getNumBlocks() == 1 &&
+ (UnrollAddParallelReductions.getNumOccurrences() > 0
+ ? UnrollAddParallelReductions
+ : ULO.AddAdditionalAccumulators) &&
+ !CompletelyUnroll && L->getNumBlocks() == 1 &&
(ULO.Runtime ||
(ExitInfos.contains(Header) && ((ExitInfos[Header].TripCount != 0 &&
ExitInfos[Header].BreakoutTrip == 0))));