[PATCH] D108833: [LoopDeletion] Use max trip count to break backedge in addition to exact one

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 27 10:53:14 PDT 2021


reames created this revision.
reames added reviewers: fhahn, nikic, mkazantsev, lebedev.ri.
Herald added subscribers: javed.absar, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

We'd added support a while back from breaking the backedge if SCEV can prove the trip count is zero.  However, we used the exact trip count which requires *all* exits be analyzeable.  I noticed while writing test cases for another patch that this disallows cases where one exit is provably taken paired with another which is unknown.  This patch adds the upper bound case.

A couple of semi-random notes for possible follow on:

- We could also use the zero-or-infinite facts SCEV produces if we added reasoning about illegality of mustprogress infinite loops.  We might be better off just having that reasoning in SCEV though.
- We could use a symbolic max trip count here instead.  I think would subsume both cases.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108833

Files:
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/test/Transforms/LoopDeletion/switch.ll
  llvm/test/Transforms/LoopDeletion/zero-btc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D108833.369139.patch
Type: text/x-patch
Size: 3396 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210827/53c87d7c/attachment-0001.bin>


More information about the llvm-commits mailing list