[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
Wed Aug 21 06:52:19 PDT 2024


vladimirradosavljevic wrote:

> > > > @wangpc-pp I have added test case. I'm working on a downstream target and we are not using llvm-testsuite, so I can't pull benchmark numbers. Can this be merged without benchmark numbers?
> > > 
> > > 
> > > You'd better provide some data since we can't see the tatal gain from this patch, and I think it can be very easy, you just need to compile llvm-test-suite twice (w and w/o this newly-added option) and compare the code size. You may refer to this doc: https://llvm.org/docs/TestSuiteGuide.html. :-)
> > 
> > 
> > Since downstream architecture is a VM, currently I'm not able to run any C or C++ program, thus can't run llvm-testsuite.
> 
> For code size evaluation, you don't need to run the tests. You can compile llvm-test-suite for RISC-V target and see the code size output.

Here is the code size comparison between `-enable-tail-merge=false` and `-tail-merge-only-bbs-without-succ=true` for AArch64 (please note that I only attached improvements larger than 10%):
```
                                              disable_tail_merge only_bbs_without_succ diff  
SingleSour...e/GCC-C-execute-pr20601-1.test       316.00             328.00              3.8%
SingleSour...ativePath/outer-loop-vect.test     10672.00           10712.00              0.4%
SingleSour...r-algebra/kernels/3mm/3mm.test      2360.00            2120.00            -10.2%
SingleSour...r-algebra/kernels/mvt/mvt.test      2336.00            2096.00            -10.3%
SingleSour...algebra/kernels/bicg/bicg.test      1548.00            1388.00            -10.3%
SingleSour.../GCC-C-execute-20140622-1.test       192.00             172.00            -10.4%
SingleSour...te/GCC-C-execute-stdarg-2.test      2184.00            1952.00            -10.6%
SingleSour.../GCC-C-execute-20020508-1.test       632.00             564.00            -10.8%
SingleSour.../GCC-C-execute-20020226-1.test       632.00             564.00            -10.8%
SingleSour...ecute/GCC-C-execute-usmul.test       260.00             232.00            -10.8%
SingleSour.../GCC-C-execute-20020506-1.test       296.00             264.00            -10.8%
SingleSour...ecute/GCC-C-execute-vrp-4.test        72.00              64.00            -11.1%
SingleSour.../GCC-C-execute-20050218-1.test       468.00             416.00            -11.1%
SingleSour...CC-C-execute-struct-ini-2.test        72.00              64.00            -11.1%
SingleSour.../GCC-C-execute-20020201-1.test       316.00             280.00            -11.4%
SingleSour.../GCC-C-execute-20020508-2.test       688.00             608.00            -11.6%
SingleSour...ute/GCC-C-execute-pr43385.test       376.00             332.00            -11.7%
SingleSour...ecute/GCC-C-execute-vrp-5.test        68.00              60.00            -11.8%
SingleSour...ute/GCC-C-execute-pr78675.test       168.00             148.00            -11.9%
SingleSour...CC-C-execute-scal-to-vec1.test       168.00             148.00            -11.9%
SingleSour...ute/GCC-C-execute-pr40386.test       672.00             592.00            -11.9%
SingleSour.../GCC-C-execute-20020508-3.test       672.00             592.00            -11.9%
SingleSour.../GCC-C-execute-ieee-inf-3.test       284.00             248.00            -12.7%
SingleSour.../GCC-C-execute-ieee-inf-2.test       284.00             248.00            -12.7%
SingleSour...te/GCC-C-execute-931004-3.test        92.00              80.00            -13.0%
SingleSour...te/GCC-C-execute-931004-7.test        92.00              80.00            -13.0%
SingleSour.../GCC-C-execute-20011109-1.test       148.00             128.00            -13.5%
SingleSour.../GCC-C-execute-20070623-1.test       560.00             484.00            -13.6%
SingleSour...lgebra/blas/gemver/gemver.test      2344.00            2024.00            -13.7%
SingleSour...ebra/blas/gesummv/gesummv.test      1136.00             976.00            -14.1%
SingleSour...ute/GCC-C-execute-pr39501.test      1276.00            1088.00            -14.7%
SingleSour...te/GCC-C-execute-931004-1.test        80.00              68.00            -15.0%
SingleSour.../UnitTests/Float/classify.test     27944.00           23640.00            -15.4%
SingleSour...e/GCC-C-execute-bf-sign-2.test       128.00             108.00            -15.6%
SingleSour...C-C-execute-ieee-fp-cmp-1.test       152.00             128.00            -15.8%
SingleSour...te/GCC-C-execute-931004-9.test       152.00             128.00            -15.8%
SingleSour...C-C-execute-ieee-fp-cmp-3.test       152.00             128.00            -15.8%
SingleSour...C-C-execute-ieee-fp-cmp-2.test       152.00             128.00            -15.8%
SingleSour...ute/GCC-C-execute-pr49886.test       200.00             168.00            -16.0%
SingleSour...ute/GCC-C-execute-align-2.test       656.00             548.00            -16.5%
SingleSour...te/GCC-C-execute-931004-5.test       140.00             116.00            -17.1%
SingleSour.../GCC-C-execute-20010924-1.test       272.00             224.00            -17.6%
SingleSour...e/GCC-C-execute-931004-11.test       200.00             164.00            -18.0%
SingleSour...e/GCC-C-execute-931004-13.test       260.00             212.00            -18.5%
SingleSour...te/GCC-C-execute-strlen-4.test      2340.00            1868.00            -20.2%
SingleSour.../GCC-C-execute-20020413-1.test       768.00             604.00            -21.4%
MultiSourc...rks/FreeBench/mason/mason.test      2140.00            1672.00            -21.9%
SingleSour.../GCC-C-execute-20141022-1.test       192.00             128.00            -33.3%
SingleSour...ute/GCC-C-execute-pr48809.test       332.00             212.00            -36.1%
SingleSour.../GCC-C-execute-20030323-1.test     21864.00            1508.00            -93.1%
```

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


More information about the llvm-commits mailing list