[SCEV][LV] Add SCEV Predicates and use them to re-implement stride versioning
authorSilviu Baranga <silviu.baranga@arm.com>
Mon, 2 Nov 2015 14:41:02 +0000 (14:41 +0000)
committerSilviu Baranga <silviu.baranga@arm.com>
Mon, 2 Nov 2015 14:41:02 +0000 (14:41 +0000)
commita0b73c263ee71ffcf44aee859e132eb74a98a3ef
tree25063b467e4b71f4ca7433bdd96fc67488ca5075
parentee10ab5e955e8d87778ff2d7e7ca79d82dd6c5b5
[SCEV][LV] Add SCEV Predicates and use them to re-implement stride versioning

Summary:
SCEV Predicates represent conditions that typically cannot be derived from
static analysis, but can be used to reduce SCEV expressions to forms which are
usable for different optimizers.

ScalarEvolution now has the rewriteUsingPredicate method which can simplify a
SCEV expression using a SCEVPredicateSet. The normal workflow of a pass using
SCEVPredicates would be to hold a SCEVPredicateSet and every time assumptions
need to be made a new SCEV Predicate would be created and added to the set.
Each time after calling getSCEV, the user will call the rewriteUsingPredicate
method.

We add two types of predicates
SCEVPredicateSet - implements a set of predicates
SCEVEqualPredicate - tests for equality between two SCEV expressions

We use the SCEVEqualPredicate to re-implement stride versioning. Every time we
version a stride, we will add a SCEVEqualPredicate to the context.
Instead of adding specific stride checks, LoopVectorize now adds a more
generic SCEV check.

We only need to add support for this in the LoopVectorizer since this is the
only pass that will do stride versioning.

Reviewers: mzolotukhin, anemet, hfinkel, sanjoy

Subscribers: sanjoy, hfinkel, rengolin, jmolloy, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251800 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/LoopAccessAnalysis.h
include/llvm/Analysis/ScalarEvolution.h
include/llvm/Analysis/ScalarEvolutionExpander.h
lib/Analysis/LoopAccessAnalysis.cpp
lib/Analysis/ScalarEvolution.cpp
lib/Analysis/ScalarEvolutionExpander.cpp
lib/Transforms/Vectorize/LoopVectorize.cpp