OSDN Git Service

[Loop Predication] Teach LP about reverse loops
authorAnna Thomas <anna@azul.com>
Mon, 4 Dec 2017 15:11:48 +0000 (15:11 +0000)
committerAnna Thomas <anna@azul.com>
Mon, 4 Dec 2017 15:11:48 +0000 (15:11 +0000)
commit7c3eddc7d6cbdde997da70dee1997751f8e48dfc
treed17933d0a09461e4c53531d26e91c8d9038d9545
parentba19c689aa7743366b2ee03b63853245d1d891c7
[Loop Predication] Teach LP about reverse loops

Summary:
Currently, we only support predication for forward loops with step
of 1.  This patch enables loop predication for reverse or
countdownLoops, which satisfy the following conditions:
   1. The step of the IV is -1.
   2. The loop has a singe latch as B(X) = X <pred>
latchLimit with pred as s> or u>
   3. The IV of the guard is the decrement
IV of the latch condition (Guard is: G(X) = X-1 u< guardLimit).

This patch was downstream for a while and is the last series of patches
that's from our LP implementation downstream.

Reviewers: apilipenko, mkazantsev, sanjoy

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D40353

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319659 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/LoopPredication.cpp
test/Transforms/LoopPredication/reverse.ll [new file with mode: 0644]