Skip to content

Commit b2b29af

Browse files
committed
Use cl::opt for call penalties
1 parent ed8487a commit b2b29af

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ static cl::opt<unsigned>
4646
NeonNonConstStrideOverhead("neon-nonconst-stride-overhead", cl::init(10),
4747
cl::Hidden);
4848

49+
static cl::opt<unsigned> CallPenaltyChangeSM(
50+
"call-penalty-sm-change", cl::init(5), cl::Hidden,
51+
cl::desc(
52+
"Penalty of calling a function that requires a change to PSTATE.SM"));
53+
54+
static cl::opt<unsigned> InlineCallPenaltyChangeSM(
55+
"inline-call-penalty-sm-change", cl::init(10), cl::Hidden,
56+
cl::desc(
57+
"Penalty of inlining a call that requires a change to PSTATE.SM"));
58+
4959
namespace {
5060
class TailFoldingOption {
5161
// These bitfields will only ever be set to something non-zero in operator=,
@@ -295,9 +305,9 @@ AArch64TTIImpl::getInlineCallPenalty(const Function *F, const CallBase &Call,
295305
SMEAttrs CalleeAttrs(Call);
296306
if (FAttrs.requiresSMChange(CalleeAttrs)) {
297307
if (F == Call.getCaller()) // (1)
298-
return 5 * DefaultCallPenalty;
308+
return CallPenaltyChangeSM * DefaultCallPenalty;
299309
if (FAttrs.requiresSMChange(SMEAttrs(*Call.getCaller()))) // (2)
300-
return 10 * DefaultCallPenalty;
310+
return InlineCallPenaltyChangeSM * DefaultCallPenalty;
301311
}
302312

303313
return DefaultCallPenalty;

0 commit comments

Comments
 (0)