Skip to content

Commit 34c6992

Browse files
[Arm] Control forced unrolling of small loops (llvm#170127)
* Add flag to control cost threshold for forced unrolling of loops. Existing value preserved as default.
1 parent 2024d67 commit 34c6992

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,11 @@ extern cl::opt<bool> EnableMaskedGatherScatters;
6666

6767
extern cl::opt<unsigned> MVEMaxSupportedInterleaveFactor;
6868

69+
static cl::opt<int> ArmForceUnrollThreshold(
70+
"arm-force-unroll-threshold", cl::init(12), cl::Hidden,
71+
cl::desc(
72+
"Threshold for forced unrolling of small loops in Arm architecture"));
73+
6974
/// Convert a vector load intrinsic into a simple llvm load instruction.
7075
/// This is beneficial when the underlying object being addressed comes
7176
/// from a constant, since we get constant-folding for free.
@@ -2731,7 +2736,7 @@ void ARMTTIImpl::getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
27312736

27322737
// Force unrolling small loops can be very useful because of the branch
27332738
// taken cost of the backedge.
2734-
if (Cost < 12)
2739+
if (Cost < ArmForceUnrollThreshold)
27352740
UP.Force = true;
27362741
}
27372742

0 commit comments

Comments
 (0)