[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)
commit47b5845e3b56a389239d9b0f4a7ccb8eea0ce52c
tree89ca37f07aab2fd22fc558ee9fd82414d7687302
parentf606b2f403448ea2c3a8f866e999a0a9f46a136d
[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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@251050 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Transforms/IndVarSimplify/eliminate-comparison.ll