diff options
| author | Max Kazantsev <max.kazantsev@azul.com> | 2017-04-17 09:52:02 +0000 |
|---|---|---|
| committer | Max Kazantsev <max.kazantsev@azul.com> | 2017-04-17 09:52:02 +0000 |
| commit | 751579cac0cf426a72d29c5959b5bb8236c7f0fb (patch) | |
| tree | 628779bc3090006114235eccb706602288b97104 /llvm/include/llvm-c/Core.h | |
| parent | 5f72e056e712866b0b58c03fe8c599b12529ccbd (diff) | |
| download | bcm5719-llvm-751579cac0cf426a72d29c5959b5bb8236c7f0fb.tar.gz bcm5719-llvm-751579cac0cf426a72d29c5959b5bb8236c7f0fb.zip | |
[LoopPeeling] Get rid of Phis that become invariant after N steps
This patch is a generalization of the improvement introduced in rL296898.
Previously, we were able to peel one iteration of a loop to get rid of a Phi that becomes
an invariant on the 2nd iteration. In more general case, if a Phi becomes invariant after
N iterations, we can peel N times and turn it into invariant.
In order to do this, we for every Phi in loop's header we define the Invariant Depth value
which is calculated as follows:
Given %x = phi <Inputs from above the loop>, ..., [%y, %back.edge].
If %y is a loop invariant, then Depth(%x) = 1.
If %y is a Phi from the loop header, Depth(%x) = Depth(%y) + 1.
Otherwise, Depth(%x) is infinite.
Notice that if we peel a loop, all Phis with Depth = 1 become invariants,
and all other Phis with finite depth decrease the depth by 1.
Thus, peeling N first iterations allows us to turn all Phis with Depth <= N
into invariants.
Reviewers: reames, apilipenko, mkuper, skatkov, anna, sanjoy
Reviewed By: sanjoy
Subscribers: llvm-commits
Differential Revision: https://reviews.llvm.org/D31613
llvm-svn: 300446
Diffstat (limited to 'llvm/include/llvm-c/Core.h')
0 files changed, 0 insertions, 0 deletions

