diff options
author | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-08-12 10:05:11 +0000 |
---|---|---|
committer | Artur Pilipenko <apilipenko@azulsystems.com> | 2016-08-12 10:05:11 +0000 |
commit | 635625855fc4e5dde3a393d09b27724e71abdf2b (patch) | |
tree | c7123abe2edc71c0189d0ad1bcd408fd1fa1d118 /llvm/lib/Analysis/LazyValueInfo.cpp | |
parent | 5247af24c3040b60dc77efcb6b764b55d78c92dc (diff) | |
download | llvm-635625855fc4e5dde3a393d09b27724e71abdf2b.zip llvm-635625855fc4e5dde3a393d09b27724e71abdf2b.tar.gz llvm-635625855fc4e5dde3a393d09b27724e71abdf2b.tar.bz2 |
[LVI] Handle any predicate in comparisons like icmp <pred> (add Val, Offset), ...
Currently LVI can only gather value constraints from comparisons like:
* icmp <pred> Val, ...
* icmp ult (add Val, Offset), ...
In fact we can handle any predicate in latter comparisons.
Reviewed By: sanjoy
Differential Revision: https://reviews.llvm.org/D23357
llvm-svn: 278493
Diffstat (limited to 'llvm/lib/Analysis/LazyValueInfo.cpp')
-rw-r--r-- | llvm/lib/Analysis/LazyValueInfo.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/LazyValueInfo.cpp b/llvm/lib/Analysis/LazyValueInfo.cpp index 5faa975..c5c9027 100644 --- a/llvm/lib/Analysis/LazyValueInfo.cpp +++ b/llvm/lib/Analysis/LazyValueInfo.cpp @@ -1191,7 +1191,7 @@ static LVILatticeVal getValueFromICmpCondition(Value *Val, ICmpInst *ICI, // range of Val guaranteed by the condition. Recognize comparisons in the from // of: // icmp <pred> Val, ... - // icmp ult (add Val, Offset), ... + // icmp <pred> (add Val, Offset), ... // The latter is the range checking idiom that InstCombine produces. Subtract // the offset from the allowed range for RHS in this case. @@ -1202,7 +1202,7 @@ static LVILatticeVal getValueFromICmpCondition(Value *Val, ICmpInst *ICI, } ConstantInt *Offset = nullptr; - if (Predicate == ICmpInst::ICMP_ULT) + if (LHS != Val) match(LHS, m_Add(m_Specific(Val), m_ConstantInt(Offset))); if (LHS == Val || Offset) { |