[PATCH] D102615: [LoopDeletion] Break backedge if we can prove that the loop is exited on 1st iteration

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 17 13:28:43 PDT 2021


reames added a comment.

I'm confused why this is worthwhile.  LoopUnrolling already knows how to symbolically execute a loop.  Shouldn't LoopUnroll fully unroll this loop by one - thus deleting the loop backedge in question?

See analyzeLoopUnrollCost in LoopUnrollPass.cpp.

Hm, glancing at that code, it looks like it symbolically evaluates only phis and branches.  I don't see any principled reason we couldn't generalize that.

In general, I would be much more comfortable as posing this as symbolic execution of the first iteration.  In the process, we're proving the exit is taken and loop deletion can happen naturally later.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D102615/new/

https://reviews.llvm.org/D102615



More information about the llvm-commits mailing list