[llvm] [Utils] Remove an unnecessary cast (NFC) (PR #157023)

via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 4 22:51:56 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-transforms

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

MergedCounts is of type double.


---
Full diff: https://github.com/llvm/llvm-project/pull/157023.diff


1 Files Affected:

- (modified) llvm/lib/Transforms/Utils/CodeLayout.cpp (+1-1) 


``````````diff
diff --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index c76b3afef50c2..27b13eeaf4d71 100644
--- a/llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp
@@ -1285,7 +1285,7 @@ class CDSortImpl {
     // Cache misses on the merged chain
     double MergedCounts = ChainPred->ExecutionCount + ChainSucc->ExecutionCount;
     double MergedSize = ChainPred->Size + ChainSucc->Size;
-    double MergedDensity = static_cast<double>(MergedCounts) / MergedSize;
+    double MergedDensity = MergedCounts / MergedSize;
     double NewScore = MergedCounts * missProbability(MergedDensity);
 
     return CurScore - NewScore;

``````````

</details>


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


More information about the llvm-commits mailing list