[PATCH] D129397: [BOLT] Do not merge cold and hot chains of basic blocks
Sergey Pupyrev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 11 09:33:12 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG722837105474: [BOLT] Do not merge cold and hot chains of basic blocks (authored by spupyrev).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D129397/new/
https://reviews.llvm.org/D129397
Files:
bolt/lib/Passes/ExtTSPReorderAlgorithm.cpp
Index: bolt/lib/Passes/ExtTSPReorderAlgorithm.cpp
===================================================================
--- bolt/lib/Passes/ExtTSPReorderAlgorithm.cpp
+++ bolt/lib/Passes/ExtTSPReorderAlgorithm.cpp
@@ -642,20 +642,25 @@
}
}
- /// Merge cold blocks to reduce code size
+ /// Merge remaining blocks into chains w/o taking jump counts into
+ /// consideration. This allows to maintain the original block order in the
+ /// absense of profile data
void mergeColdChains() {
for (BinaryBasicBlock *SrcBB : BF.layout()) {
// Iterating in reverse order to make sure original fallthrough jumps are
- // merged first
+ // merged first; this might be beneficial for code size.
for (auto Itr = SrcBB->succ_rbegin(); Itr != SrcBB->succ_rend(); ++Itr) {
BinaryBasicBlock *DstBB = *Itr;
size_t SrcIndex = SrcBB->getLayoutIndex();
size_t DstIndex = DstBB->getLayoutIndex();
Chain *SrcChain = AllBlocks[SrcIndex].CurChain;
Chain *DstChain = AllBlocks[DstIndex].CurChain;
+ bool IsColdSrc = SrcChain->executionCount() == 0;
+ bool IsColdDst = DstChain->executionCount() == 0;
if (SrcChain != DstChain && !DstChain->isEntryPoint() &&
SrcChain->blocks().back()->Index == SrcIndex &&
- DstChain->blocks().front()->Index == DstIndex)
+ DstChain->blocks().front()->Index == DstIndex &&
+ IsColdSrc == IsColdDst)
mergeChains(SrcChain, DstChain, 0, MergeTypeTy::X_Y);
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129397.443673.patch
Type: text/x-patch
Size: 1544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220711/e78ea2ae/attachment.bin>
More information about the llvm-commits
mailing list