[llvm] [BranchFolding] Add an option to tail merge only bbs without successors (PR #101969)
Juan Manuel Martinez CaamaƱo via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 11 02:47:01 PDT 2024
================
@@ -1035,6 +1040,9 @@ bool BranchFolder::TailMergeBlocks(MachineFunction &MF) {
if (MergePotentials.size() >= 2)
MadeChange |= TryTailMergeBlocks(nullptr, nullptr, MinCommonTailLength);
+ if (TailMergeOnlyBBsWithoutSucc)
----------------
jmmartinez wrote:
Hello !
> this option can reduce code size in case function has multiple return points that can be merged.
Is the driver that sets the option when optimizing for size?
Could we instead check if _optimizing for code size_ and _the function has multiple return points that can be merged_ instead of using an option?
I'd also expect that if a branch edge [is hot](https://llvm.org/doxygen/classllvm_1_1MachineBranchProbabilityInfo.html#a6cd25f432a77253606cc6387d0057833) this transformation would still be applied (even if optimizing for size).
https://github.com/llvm/llvm-project/pull/101969
More information about the llvm-commits
mailing list