[llvm] [FuncSpec] Update function specialization to handle phi-chains (PR #71442)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 13:24:08 PST 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 f4df0c48e912f01abe2ecaad207b469745620c5d 5f83d4aec7656bdb15e2c0c105d4cf69cba04486 -- llvm/include/llvm/Transforms/IPO/FunctionSpecialization.h llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
index 98f7de3eed98..87dfd413d02a 100644
--- a/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp
@@ -362,7 +362,8 @@ Constant *InstCostVisitor::visitPHINode(PHINode &I) {
};
if (CanConstantFoldPhi(&I)) {
- assert(Const && "CanConstantfoldPhi expected to have set Const when returing true");
+ assert(Const &&
+ "CanConstantfoldPhi expected to have set Const when returing true");
return Const;
}
@@ -921,25 +922,24 @@ bool FunctionSpecializer::findSpecializations(Function *F, unsigned FuncSize,
}
// Minimum codesize savings.
if (B.CodeSize < MinCodeSizeSavings * FuncSize / 100) {
- LLVM_DEBUG(dbgs()
- << "FnSpecialization: Insufficinet CodeSize Saving("
- << B.CodeSize << " > "
- << MinCodeSizeSavings * FuncSize / 100 << ")\n");
+ LLVM_DEBUG(dbgs() << "FnSpecialization: Insufficinet CodeSize Saving("
+ << B.CodeSize << " > "
+ << MinCodeSizeSavings * FuncSize / 100 << ")\n");
return false;
}
// Minimum latency savings.
if (B.Latency < MinLatencySavings * FuncSize / 100) {
- LLVM_DEBUG(dbgs()
- << "FnSpecialization: Insufficinet Latency Saving("
- << B.Latency << " > " << MinLatencySavings * FuncSize / 100
- << ")\n");
+ LLVM_DEBUG(dbgs() << "FnSpecialization: Insufficinet Latency Saving("
+ << B.Latency << " > "
+ << MinLatencySavings * FuncSize / 100 << ")\n");
return false;
}
// Maximum codesize growth.
if (FuncGrowth / FuncSize > MaxCodeSizeGrowth) {
- LLVM_DEBUG(dbgs() << "FnSpecialization: Func Growth exceeds threshold("
- << FuncGrowth / FuncSize << " > "
- << MaxCodeSizeGrowth << ")\n");
+ LLVM_DEBUG(dbgs()
+ << "FnSpecialization: Func Growth exceeds threshold("
+ << FuncGrowth / FuncSize << " > " << MaxCodeSizeGrowth
+ << ")\n");
return false;
}
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/71442
More information about the llvm-commits
mailing list