[llvm] [AArch64] Stop count cost once force-unroll threshold is reached (NFC). (PR #228247)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 3 01:49:49 PDT 2026
https://github.com/fhahn updated https://github.com/llvm/llvm-project/pull/228247
>From 46c9381740b20de5b2f03fe30bdf3400be24ec98 Mon Sep 17 00:00:00 2001
From: Florian Hahn <flo at fhahn.com>
Date: Tue, 29 Sep 2026 09:18:33 +0100
Subject: [PATCH] [AArch64] Stop count cost once force-unroll threshold is
reached (NFC).
The cost is only used to compare against Aarch64ForceUnrollThreshold.
Stop counting when we reach it, to avoid unnecessary cost queries.
Reduces compile-time on AArch64 by -0.08%.
https://llvm-compile-time-tracker.com/compare.php?from=5ffb13d6d1f87195bba8af13366a152a7de2bfe0&to=18f3cab804f98653c6b3a56b6ac02c9f6960b672&stat=instructions:u
---
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index ddea78fa4e8083..a40a58e6b7fa2e 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -6287,6 +6287,9 @@ void AArch64TTIImpl::getUnrollingPreferences(
return;
}
+ // The cost is only compared against Aarch64ForceUnrollThreshold below.
+ if (Cost >= Aarch64ForceUnrollThreshold)
+ continue;
SmallVector<const Value *, 4> Operands(I.operand_values());
Cost += getInstructionCost(&I, Operands,
TargetTransformInfo::TCK_SizeAndLatency);
More information about the llvm-commits
mailing list