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

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


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

MergedCounts is of type double.


>From 7937f74825b92df01913f4679fa8ee73c9067519 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Thu, 4 Sep 2025 10:29:11 -0700
Subject: [PATCH] [Utils] Remove an unnecessary cast (NFC)

MergedCounts is of type double.
---
 llvm/lib/Transforms/Utils/CodeLayout.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;



More information about the llvm-commits mailing list