diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-05 23:45:38 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-05 23:45:38 +0000 |
commit | c1a2977fb24a799a11f3586cfd45d39f300ae002 (patch) | |
tree | 5875ee946b1e7b09f6298ab4421c3e425229d947 /llvm/include | |
parent | 8307ede58f16ffeffc127ef8acd94c4b4a23c804 (diff) | |
download | bcm5719-llvm-c1a2977fb24a799a11f3586cfd45d39f300ae002.tar.gz bcm5719-llvm-c1a2977fb24a799a11f3586cfd45d39f300ae002.zip |
Re-apply r251050 with a for PR25421
The bug: I missed adding break statements in the switch / case.
Original commit message:
[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: 252236
Diffstat (limited to 'llvm/include')
-rw-r--r-- | llvm/include/llvm/Analysis/ScalarEvolution.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h index 65125a7da5e..c180ce37e39 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolution.h +++ b/llvm/include/llvm/Analysis/ScalarEvolution.h @@ -732,6 +732,14 @@ namespace llvm { bool isKnownPredicateWithRanges(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS); + /// Try to prove the condition described by "LHS Pred RHS" by ruling out + /// integer overflow. + /// + /// For instance, this will return true for "A s< (A + C)<nsw>" if C is + /// positive. + bool isKnownPredicateViaNoOverflow(ICmpInst::Predicate Pred, + const SCEV *LHS, const SCEV *RHS); + /// Try to split Pred LHS RHS into logical conjunctions (and's) and try to /// prove them individually. bool isKnownPredicateViaSplitting(ICmpInst::Predicate Pred, const SCEV *LHS, |