[llvm] [LSR][term-fold] Adjust expansion budget based on trip count (PR #80304)

via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 08:08:41 PST 2024


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 390d66b03b5a5e352b7d696aaed679a2deb25c6c 71c5711fd2e14b1688d41326132045a1c1486f74 -- 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 356cc5b11a..9fc8bea920 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -6817,11 +6817,11 @@ canFoldTermCondOfLoop(Loop *L, ScalarEvolution &SE, DominatorTree &DT,
   // the allowed cost with the loops trip count as best we can.
   const unsigned ExpansionBudget = [&]() {
     if (unsigned SmallTC = SE.getSmallConstantMaxTripCount(L))
-      return std::min(2*SCEVCheapExpansionBudget, SmallTC);
+      return std::min(2 * SCEVCheapExpansionBudget, SmallTC);
     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);
@@ -6873,8 +6873,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/80304


More information about the llvm-commits mailing list