[llvm] [AArch64][SME] Extend Inliner cost-model with custom penalty for calls. (PR #68416)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 6 06:18:45 PDT 2023
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 22f81b4cf4cbf001a8a27877274eb157a12466c3 e98d96e643aa52828f54b0a1f3e3d113896185fa -- llvm/include/llvm/Analysis/InlineCost.h llvm/include/llvm/Analysis/TargetTransformInfo.h llvm/include/llvm/Analysis/TargetTransformInfoImpl.h llvm/lib/Analysis/InlineCost.cpp llvm/lib/Analysis/TargetTransformInfo.cpp llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp llvm/lib/Target/AArch64/AArch64TargetTransformInfo.h llvm/lib/Transforms/IPO/PartialInlining.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 7a85c03d6592..4f5f85a2b3c8 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -2673,9 +2673,8 @@ public:
const Function *Callee) const override {
return Impl.areInlineCompatible(Caller, Callee);
}
- unsigned
- getInlineCallPenalty(const Function *F, const CallBase &Call,
- unsigned DefaultCallPenalty) const override {
+ unsigned getInlineCallPenalty(const Function *F, const CallBase &Call,
+ unsigned DefaultCallPenalty) const override {
return Impl.getInlineCallPenalty(F, Call, DefaultCallPenalty);
}
bool areTypesABICompatible(const Function *Caller, const Function *Callee,
diff --git a/llvm/lib/Analysis/TargetTransformInfo.cpp b/llvm/lib/Analysis/TargetTransformInfo.cpp
index 10ed3a4437da..caa9b17ae695 100644
--- a/llvm/lib/Analysis/TargetTransformInfo.cpp
+++ b/llvm/lib/Analysis/TargetTransformInfo.cpp
@@ -1133,9 +1133,10 @@ bool TargetTransformInfo::areInlineCompatible(const Function *Caller,
return TTIImpl->areInlineCompatible(Caller, Callee);
}
-unsigned TargetTransformInfo::getInlineCallPenalty(
- const Function *F, const CallBase &Call,
- unsigned DefaultCallPenalty) const {
+unsigned
+TargetTransformInfo::getInlineCallPenalty(const Function *F,
+ const CallBase &Call,
+ unsigned DefaultCallPenalty) const {
return TTIImpl->getInlineCallPenalty(F, Call, DefaultCallPenalty);
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
index e107c7d8540c..8923fe0ed7e0 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -200,9 +200,9 @@ static bool isSMEABIRoutineCall(const CallInst &CI) {
.Default(false);
}
-/// Returns true if the function has explicit operations that can only be lowered
-/// using incompatible instructions for the selected mode.
-/// This also returns true if the function F may use or modify ZA state.
+/// Returns true if the function has explicit operations that can only be
+/// lowered using incompatible instructions for the selected mode. This also
+/// returns true if the function F may use or modify ZA state.
static bool hasPossibleIncompatibleOps(const Function *F) {
for (const BasicBlock &BB : *F) {
for (const Instruction &I : BB) {
@@ -270,7 +270,7 @@ AArch64TTIImpl::getInlineCallPenalty(const Function *F, const CallBase &Call,
SMEAttrs FAttrs(*F);
SMEAttrs CalleeAttrs(Call);
if (FAttrs.requiresSMChange(CalleeAttrs)) {
- if (F == Call.getCaller()) // (1)
+ if (F == Call.getCaller()) // (1)
return 5 * DefaultCallPenalty;
if (FAttrs.requiresSMChange(SMEAttrs(*Call.getCaller()))) // (2)
return 10 * DefaultCallPenalty;
``````````
</details>
https://github.com/llvm/llvm-project/pull/68416
More information about the llvm-commits
mailing list