[llvm] b4b42bd - Cleaning up unreachable code in CodeLayout

via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 28 09:22:33 PDT 2023


Author: spupyrev
Date: 2023-08-28T09:22:20-07:00
New Revision: b4b42bd6522f22286fd2a409fe0fb140c86800f7

URL: https://github.com/llvm/llvm-project/commit/b4b42bd6522f22286fd2a409fe0fb140c86800f7
DIFF: https://github.com/llvm/llvm-project/commit/b4b42bd6522f22286fd2a409fe0fb140c86800f7.diff

LOG: Cleaning up unreachable code in CodeLayout

- removing an unreachable instruction from the code (earlier code merge bug);
- silencing "unused variable" warnings.

Reviewed By: rahmanl

Differential Revision: https://reviews.llvm.org/D158859

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/CodeLayout.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/CodeLayout.cpp b/llvm/lib/Transforms/Utils/CodeLayout.cpp
index 6ef4ae3341e3d7..c8c0823daaa6bd 100644
--- a/llvm/lib/Transforms/Utils/CodeLayout.cpp
+++ b/llvm/lib/Transforms/Utils/CodeLayout.cpp
@@ -952,7 +952,6 @@ class ExtTSPImpl {
                 const double DL = ChainDensity[L];
                 const double DR = ChainDensity[R];
                 // Compare by density and break ties by chain identifiers.
-                return (DL != DR) ? (DL > DR) : (L->Id < R->Id);
                 return std::make_tuple(-DL, L->Id) <
                        std::make_tuple(-DR, R->Id);
               });
@@ -1104,7 +1103,7 @@ class CDSortImpl {
 
     // Insert the edges into the queue.
     for (ChainT *ChainPred : HotChains) {
-      for (const auto &[Chain, Edge] : ChainPred->Edges) {
+      for (const auto &[_, Edge] : ChainPred->Edges) {
         // Ignore self-edges.
         if (Edge->isSelfEdge())
           continue;
@@ -1137,9 +1136,9 @@ class CDSortImpl {
       ChainT *BestDstChain = BestEdge->dstChain();
 
       // Remove outdated edges from the queue.
-      for (const auto &[Chain, ChainEdge] : BestSrcChain->Edges)
+      for (const auto &[_, ChainEdge] : BestSrcChain->Edges)
         Queue.erase(ChainEdge);
-      for (const auto &[Chain, ChainEdge] : BestDstChain->Edges)
+      for (const auto &[_, ChainEdge] : BestDstChain->Edges)
         Queue.erase(ChainEdge);
 
       // Merge the best pair of chains.
@@ -1148,7 +1147,7 @@ class CDSortImpl {
                   BestGain.mergeType());
 
       // Insert newly created edges into the queue.
-      for (const auto &[Chain, Edge] : BestSrcChain->Edges) {
+      for (const auto &[_, Edge] : BestSrcChain->Edges) {
         // Ignore loop edges.
         if (Edge->isSelfEdge())
           continue;


        


More information about the llvm-commits mailing list