[llvm] [BranchFolding] Add an option to tail merge only bbs without successors (PR #101969)
Vladimir Radosavljevic via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 14 07:27:46 PDT 2024
================
@@ -1035,6 +1040,9 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
if (MergePotentials.size() >= 2)
MadeChange |= TryTailMergeBlocks(nullptr, nullptr, MinCommonTailLength);
+ if (TailMergeOnlyBBsWithoutSucc)
----------------
vladimirradosavljevic wrote:
Sorry for the confusion, but this option can reduce code size when comparing application size when `-enable-tail-merge=false` is passed, not in usual cases.
I'm working on a downstream target where jumps are not cheap and BranchFolding can create a lot of them in hot paths. For applications where performance is pivotal, I found that disabling tail merge (`-enable-tail-merge=false`) is boosting performance a lot, and saw that we can reduce code size if tail merge was performed for returning BBs, which in our case is a cold path. Because of this, I introduced this option to cover that case.
https://github.com/llvm/llvm-project/pull/101969
More information about the llvm-commits
mailing list