[llvm] [CodeLayout] Faster basic block reordering, ext-tsp (PR #68617)
Rahman Lavaee via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 23 12:38:36 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.
----------------
rlavaee wrote:
I am confused by this comment. How can the hot section get smaller? Yes, we don't merge the chains, but they still get concatenated at the end.
https://github.com/llvm/llvm-project/pull/68617
More information about the llvm-commits
mailing list