[LoopDeletion] Break backedge of loops when known not taken
authorPhilip Reames <listmail@philipreames.com>
Mon, 4 Jan 2021 17:19:29 +0000 (09:19 -0800)
committerPhilip Reames <listmail@philipreames.com>
Mon, 4 Jan 2021 17:19:29 +0000 (09:19 -0800)
commitdd6bb367d19e3bf18353e40de54d35480999a930
treed4e16ec73dfba4b8cb2aa35538ea7f6da1de49aa
parentfe5d51a4897c26696fede55e120c912df60cd3f4
[LoopDeletion] Break backedge of loops when known not taken

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.

Differential Revision: https://reviews.llvm.org/D93906
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 [new file with mode: 0644]