Re-commit r255115, with the PredicatedScalarEvolution class moved to
authorSilviu Baranga <silviu.baranga@arm.com>
Wed, 9 Dec 2015 16:06:28 +0000 (16:06 +0000)
committerSilviu Baranga <silviu.baranga@arm.com>
Wed, 9 Dec 2015 16:06:28 +0000 (16:06 +0000)
commit90f6cd579a7dd1d91b8931bb38a271723749f326
tree9fa2fe7c6939b39e01323eb5c8ec98e52f47f8e5
parent6d8e50b6e2c07d1502dc899dd1741af14111b480
Re-commit r255115, with the PredicatedScalarEvolution class moved to
ScalarEvolution.h, in order to avoid cyclic dependencies between the Transform
and Analysis modules:

[LV][LAA] Add a layer over SCEV to apply run-time checked knowledge on SCEV expressions

Summary:
This change creates a layer over ScalarEvolution for LAA and LV, and centralizes the
usage of SCEV predicates. The SCEVPredicatedLayer takes the statically deduced knowledge
by ScalarEvolution and applies the knowledge from the SCEV predicates. The end goal is
that both LAA and LV should use this interface everywhere.

This also solves a problem involving the result of SCEV expression rewritting when
the predicate changes. Suppose we have the expression (sext {a,+,b}) and two predicates
  P1: {a,+,b} has nsw
  P2: b = 1.

Applying P1 and then P2 gives us {a,+,1}, while applying P2 and the P1 gives us
sext({a,+,1}) (the AddRec expression was changed by P2 so P1 no longer applies).
The SCEVPredicatedLayer maintains the order of transformations by feeding back
the results of previous transformations into new transformations, and therefore
avoiding this issue.

The SCEVPredicatedLayer maintains a cache to remember the results of previous
SCEV rewritting results. This also has the benefit of reducing the overall number
of expression rewrites.

Reviewers: mzolotukhin, anemet

Subscribers: jmolloy, sanjoy, llvm-commits

Differential Revision: http://reviews.llvm.org/D14296

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@255122 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/LoopAccessAnalysis.h
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/LoopAccessAnalysis.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Transforms/Scalar/LoopDistribute.cpp
lib/Transforms/Scalar/LoopLoadElimination.cpp
lib/Transforms/Utils/LoopVersioning.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp