[llvm] [CodeLayout] Faster basic block reordering, ext-tsp (PR #68617)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 12 17:47:07 PDT 2023
================
@@ -699,28 +719,44 @@ class ExtTSPImpl {
/// Deterministically compare pairs of chains.
auto compareChainPairs = [](const ChainT *A1, const ChainT *B1,
const ChainT *A2, const ChainT *B2) {
- if (A1 != A2)
- return A1->Id < A2->Id;
- return B1->Id < B2->Id;
+ return std::make_tuple(A1->Id, B1->Id) < std::make_tuple(A2->Id, B2->Id);
};
+ double PrevScore = 1e9;
while (HotChains.size() > 1) {
ChainT *BestChainPred = nullptr;
ChainT *BestChainSucc = nullptr;
MergeGainT BestGain;
// Iterate over all pairs of chains.
for (ChainT *ChainPred : HotChains) {
+ // Since the score of merging doesn't increase, we can stop early when
----------------
spupyrev wrote:
Again, this is for speeding up the algorithm. The empirical speedup seems to be worth the quality regression.
Adjusted the comment.
https://github.com/llvm/llvm-project/pull/68617
More information about the llvm-commits
mailing list