[SCEV] Teach SCEV some axioms about non-wrapping arithmetic
authorSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 22 Oct 2015 19:57:29 +0000 (19:57 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Thu, 22 Oct 2015 19:57:29 +0000 (19:57 +0000)
commit1123148d40691a9ce08879fff878a02acd0f6822
tree4c4e3e23406d6426468339e9fd908880b69c835b
parenta060e602fd6afa836f17da5b7fc865651714d259
[SCEV] Teach SCEV some axioms about non-wrapping arithmetic

Summary:
 - A s<  (A + C)<nsw> if C >  0
 - A s<= (A + C)<nsw> if C >= 0
 - (A + C)<nsw> s<  A if C <  0
 - (A + C)<nsw> s<= A if C <= 0

Right now `C` needs to be a constant, but we can later generalize it to
be a non-constant if needed.

Reviewers: atrick, hfinkel, reames, nlewycky

Subscribers: sanjoy, llvm-commits

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

llvm-svn: 251050
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
llvm/test/Transforms/IndVarSimplify/eliminate-comparison.ll