[PATCH] D93906: [LoopDeletion] Break backedge of loops when known not taken

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 29 10:41:41 PST 2020


reames created this revision.
reames added reviewers: fhahn, jdoerfert, jonpa, atmnpatel.
Herald added subscribers: dantrushin, javed.absar, bollu, hiraditya, mcrosier.
reames requested review of this revision.
Herald added a project: LLVM.

This is an extension to LoopDeletion that came up recently in another review discussion (D93734 <https://reviews.llvm.org/D93734>).

The basic idea is that if SCEV can prove the backedge isn't taken, we can go ahead and get rid of the backedge (and thus the loop) while leaving the rest of the control in place.  This nicely handles cases with dispatch between multiple exits and internal side effects.

I'd appreciate a careful review of the LoopInfo handling here.  I tried to parallel the existing deleteDeadLoop handling, but this code has subtle invariants and stale comments.  Definitely room for error.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D93906

Files:
  llvm/include/llvm/Transforms/Utils/LoopUtils.h
  llvm/lib/Transforms/Scalar/LoopDeletion.cpp
  llvm/lib/Transforms/Utils/LoopUtils.cpp
  llvm/test/Transforms/IndVarSimplify/X86/pr45360.ll
  llvm/test/Transforms/IndVarSimplify/exit_value_test2.ll
  llvm/test/Transforms/LoopDeletion/update-scev.ll
  llvm/test/Transforms/LoopDeletion/zero-btc.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93906.313982.patch
Type: text/x-patch
Size: 18183 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201229/b986b68c/attachment.bin>


More information about the llvm-commits mailing list