[PATCH] D110613: [Taildup] Don't tail-duplicate loop header with multiple successors as its latches

JunMa via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 28 02:11:57 PDT 2021


junparser created this revision.
junparser added reviewers: alexfh, efriedma, spatel, xbolva00, jyknight.
Herald added subscribers: pengfei, hiraditya.
junparser requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

when Taildup hit loop with multiple latches like:

  //    1 -> 2 <-> 3                 |
  //          \  <-> 4               |
  //           \   <-> 5             |
  //            \---> rest           |

it may transform this loop into multiple loops by duplicate loop header.
However, this change may has little benefit while makes cfg much complex.
In some uncommon cases, it causes large compile time regression (offered by 
@alexfh in D106056 <https://reviews.llvm.org/D106056>).

This patch disable tail-duplicate of such cases.
PS: It checks the number of latches > 2 since we want to omit conditional branch.

TestPlan: check-llvm


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110613

Files:
  llvm/lib/CodeGen/TailDuplicator.cpp
  llvm/test/CodeGen/X86/tail-dup-multiple-latch-loop.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110613.375499.patch
Type: text/x-patch
Size: 5227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210928/88611cd6/attachment.bin>


More information about the llvm-commits mailing list