William Moses via llvm-dev
2019-Jun-22 19:19 UTC
[llvm-dev] Optimization Pass to Split a "Merge" Block
Hi all, Is there an existing optimization in LLVM that will get split or rid of the "merge" block into the cases of where it's from. Evidently doing this for all cases could result in a blowup of code, but perhaps this exists somewhere for more limited cases (for example where the merge block could be eliminated entirely). Cheers, Billy Moses A: ... br merge B: ... br merge merge: %var = phi [%a, A], [%b, B] %wherefrom = phi [true, A], [false, B] br cond %wherefrom A2, B2 A2: .... B2: .... -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190622/7d2467ad/attachment.html>
Jameson Nash via llvm-dev
2019-Jun-22 21:18 UTC
[llvm-dev] Optimization Pass to Split a "Merge" Block
Are you thinking of Jump Threading? I can't say for certain whether LLVM's implementation would handle this exact case, but that's the pass I'd expect to be applicable here. On Sat, Jun 22, 2019 at 3:19 PM William Moses via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all, > > Is there an existing optimization in LLVM that will get split or rid of > the "merge" block into the cases of where it's from. > > Evidently doing this for all cases could result in a blowup of code, but > perhaps this exists somewhere for more limited cases (for example where the > merge block could be eliminated entirely). > > Cheers, > Billy Moses > > A: > ... > br merge > > B: > ... > br merge > > merge: > %var = phi [%a, A], [%b, B] > %wherefrom = phi [true, A], [false, B] > br cond %wherefrom A2, B2 > > A2: > .... > > B2: > .... > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190622/d6dfa7dd/attachment.html>
Momchil Velikov via llvm-dev
2019-Jun-22 21:27 UTC
[llvm-dev] Optimization Pass to Split a "Merge" Block
Sounds like tail duplication , lib/CodeGen/TailDuplication.cpp On Sat, Jun 22, 2019 at 8:19 PM William Moses via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Hi all, > > Is there an existing optimization in LLVM that will get split or rid of > the "merge" block into the cases of where it's from. > > Evidently doing this for all cases could result in a blowup of code, but > perhaps this exists somewhere for more limited cases (for example where the > merge block could be eliminated entirely). > > Cheers, > Billy Moses > > A: > ... > br merge > > B: > ... > br merge > > merge: > %var = phi [%a, A], [%b, B] > %wherefrom = phi [true, A], [false, B] > br cond %wherefrom A2, B2 > > A2: > .... > > B2: > .... > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190622/4d27d37d/attachment.html>