[llvm] [lsr][term-fold] Restrict expansion budget for profiled loops (PR #74747)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 7 10:57:37 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 0e6685ab1a8313cd1dc7eb3c99ff642e6c492aa2 0aad007ef1372d7b7bd74aae10261b96bfae07e0 -- llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 2bcf6a2d65..a4811fd46e 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -6785,9 +6785,9 @@ canFoldTermCondOfLoop(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
// the allowed cost with the loops trip count as best we can.
const unsigned ExpansionBudget = [&]() {
if (std::optional<unsigned> SmallTC = getLoopEstimatedTripCount(L))
- return std::min(2*SCEVCheapExpansionBudget, *SmallTC);
+ return std::min(2 * SCEVCheapExpansionBudget, *SmallTC);
// Unknown trip count, assume long running by default.
- return 2*SCEVCheapExpansionBudget;
+ return 2 * SCEVCheapExpansionBudget;
}();
const SCEV *BECount = SE.getBackedgeTakenCount(L);
@@ -6838,8 +6838,8 @@ canFoldTermCondOfLoop(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
continue;
}
- if (Expander.isHighCostExpansion(TermValueSLocal, L, ExpansionBudget,
- &TTI, InsertPt)) {
+ if (Expander.isHighCostExpansion(TermValueSLocal, L, ExpansionBudget, &TTI,
+ InsertPt)) {
LLVM_DEBUG(
dbgs() << "Is too expensive to expand terminating value for phi node"
<< PN << "\n");
``````````
</details>
https://github.com/llvm/llvm-project/pull/74747
More information about the llvm-commits
mailing list