[llvm] [LoopInterchange] Fix overflow in cost calculation (PR #111807)

via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 03:12:48 PDT 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 60f3e67dae90f43698ae67167d0e024ff2ab0932 c61b8f02c100cb11ba85032cc9afbbb2995040ca --extensions cpp -- llvm/lib/Analysis/LoopCacheAnalysis.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Analysis/LoopCacheAnalysis.cpp b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
index 3e03b5ba26..fc50489ee7 100644
--- a/llvm/lib/Analysis/LoopCacheAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopCacheAnalysis.cpp
@@ -719,7 +719,8 @@ CacheCost::computeLoopCacheCost(const Loop &L,
     CacheCostTy RefGroupCost = computeRefGroupCacheCost(RG, L);
 
     // Saturate the cost to INT MAX if the value can overflow.
-    if (RefGroupCost > (std::numeric_limits<int64_t>::max() / TripCountsProduct))
+    if (RefGroupCost >
+        (std::numeric_limits<int64_t>::max() / TripCountsProduct))
       LoopCost = std::numeric_limits<int64_t>::max();
     else
       LoopCost += RefGroupCost * TripCountsProduct;

``````````

</details>


https://github.com/llvm/llvm-project/pull/111807


More information about the llvm-commits mailing list