[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
Fri Aug 9 07:20:22 PDT 2024


================
@@ -85,6 +85,11 @@ TailMergeSize("tail-merge-size",
               cl::desc("Min number of instructions to consider tail merging"),
               cl::init(3), cl::Hidden);
 
+static cl::opt<bool> TailMergeOnlyBBsWithoutSucc(
+    "tail-merge-only-bbs-without-succ",
+    cl::desc("Tail merge only basic blocks without successors"),
+    cl::init(false), cl::Hidden);
----------------
vladimirradosavljevic wrote:

This flag should be used like other flags (e.g. `-tail-merge-size`, `-tail-dup-size`) for specific applications to get maximum possible performance, and in this case target hook won't help. Since `-enable-tail-merge=false` disables tail merge for all BBs, I introduced this option to just enable tail merge for exiting BBs (which are not frequently executed), so we can get code size reduction.
Does this make sense to you?

https://github.com/llvm/llvm-project/pull/101969


More information about the llvm-commits mailing list