[llvm] 34c6992 - [Arm] Control forced unrolling of small loops (#170127)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 2 00:39:30 PST 2025
Author: Vladi Krapp
Date: 2025-12-02T08:39:26Z
New Revision: 34c699246d9d2ad0e09306d4faed6e8d7ec87aa5
URL: https://github.com/llvm/llvm-project/commit/34c699246d9d2ad0e09306d4faed6e8d7ec87aa5
DIFF: https://github.com/llvm/llvm-project/commit/34c699246d9d2ad0e09306d4faed6e8d7ec87aa5.diff
LOG: [Arm] Control forced unrolling of small loops (#170127)
* Add flag to control cost threshold for forced unrolling of loops.
Existing value preserved as default.
Added:
Modified:
llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index fdb0ec40cb41f..cecc9544ed835 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -66,6 +66,11 @@ extern cl::opt<bool> EnableMaskedGatherScatters;
extern cl::opt<unsigned> MVEMaxSupportedInterleaveFactor;
+static cl::opt<int> ArmForceUnrollThreshold(
+ "arm-force-unroll-threshold", cl::init(12), cl::Hidden,
+ cl::desc(
+ "Threshold for forced unrolling of small loops in Arm architecture"));
+
/// Convert a vector load intrinsic into a simple llvm load instruction.
/// This is beneficial when the underlying object being addressed comes
/// from a constant, since we get constant-folding for free.
@@ -2731,7 +2736,7 @@ void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
// Force unrolling small loops can be very useful because of the branch
// taken cost of the backedge.
- if (Cost < 12)
+ if (Cost < ArmForceUnrollThreshold)
UP.Force = true;
}
More information about the llvm-commits
mailing list