[PATCH] D30572: Remove equal BBs from a function

Andrew V. Tischenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 22 07:58:58 PDT 2017


avt77 added a comment.

Matthias,
Thank you for the fast reply.

> ! In https://reviews.llvm.org/D30572#707521, @MatzeB wrote:
>  Did you see the new MachineOutliner yet? It is also merging equivalent code but is not restricted to a single basic block but find duplicate sequences of instructions and can also merge across functions.

Now, I did not see it but it seems it does more complex thing: inside my patch I'm calling it "candidates for -O1 optimizations. That's fine that you did it already!

In https://reviews.llvm.org/D30572#707532, @MatzeB wrote:

> We also have TailMerging (part of BranchFolding) which should merges equivalent instruction sequences going to a return and is enabled by default. Apparently it doesn't catch the case in loop-search.ll (and you didn't provide additional examples/tests unfortunately) but we should better search for bugs there instead of adding a new pass.


I've seen this code but it did not work for me that's why I implemented the new pass. But I deadly agree that it's better to fix the possible bugs inside this pass instead of adding a new pass: I'll try to redesign my job.
One comment: I bootstrapped Clang with my patch and found hundreds of duplicated BBs. Especially many of them were accessed through Jump Tables. Do you know about this issue?
And more: TailMerging works with return only or with unconditional jumps as well?


https://reviews.llvm.org/D30572





More information about the llvm-commits mailing list