[llvm] [CodeLayout] Faster basic block reordering, ext-tsp (PR #68617)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 24 09:36:03 PDT 2023


================
@@ -734,14 +743,25 @@ class ExtTSPImpl {
         // Get candidates for merging with the current chain.
         for (const auto &[ChainSucc, Edge] : ChainPred->Edges) {
           // Ignore loop edges.
-          if (ChainPred == ChainSucc)
+          if (Edge->isSelfEdge())
             continue;
-
           // Stop early if the combined chain violates the maximum allowed size.
           if (ChainPred->numBlocks() + ChainSucc->numBlocks() >= MaxChainSize)
             continue;
+          // Don't merge the chains if they have vastly different densities.
+          // We stop early if the ratio between the densities exceeds
+          // MaxMergeDensityRatio. Smaller values of the option result in
+          // fewer merges (hence, more chains), which in turn typically yields
+          // smaller size of the hot code section.
----------------
spupyrev wrote:

I adjusted the comment (and the one above). Please check if the new one makes sense. Thanks

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


More information about the llvm-commits mailing list