Teach SCEV normalization to de/normalize non-affine add recs
authorSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 25 Apr 2017 00:09:19 +0000 (00:09 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Tue, 25 Apr 2017 00:09:19 +0000 (00:09 +0000)
commitbbebcb6c4d18b80a5bb0d0a3187624d61ebaa305
tree06619a27221ebc8926573bbbee4342167eda347d
parent831c72f4a9b7f8830633e5fef30a7892a1acecf8
Teach SCEV normalization to de/normalize non-affine add recs

Summary:
Before this change, SCEV Normalization would incorrectly normalize
non-affine add recurrences.  To work around this there was (still is)
a check in place to make sure we only tried to normalize affine add
recurrences.

We recently found a bug in aforementioned check to bail out of
normalizing non-affine add recurrences.  However, instead of fixing
the bailout, I have decided to teach SCEV normalization to work
correctly with non-affine add recurrences, making the bailout
unnecessary (I'll remove it in a subsequent change).

I've also added some unit tests (which would have failed before this
change).

Reviewers: atrick, sunfish, efriedma

Reviewed By: atrick

Subscribers: mcrosier, mzolotukhin, llvm-commits

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

llvm-svn: 301281
llvm/lib/Analysis/ScalarEvolutionNormalization.cpp
llvm/unittests/Analysis/ScalarEvolutionTest.cpp