diff options
author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-06 19:01:03 +0000 |
---|---|---|
committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-11-06 19:01:03 +0000 |
commit | c01b4d2b28184d0a9efee934c8a5b7aab57984ab (patch) | |
tree | fdd6313ad25e0502f572b34f09b6b674bfa5b44f /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 9349dcc74a10f3056639b455d56288e62e23f13c (diff) | |
download | bcm5719-llvm-c01b4d2b28184d0a9efee934c8a5b7aab57984ab.tar.gz bcm5719-llvm-c01b4d2b28184d0a9efee934c8a5b7aab57984ab.zip |
[ValueTracking] De-pessimize isImpliedCondition around unsigned compares
Summary:
Currently `isImpliedCondition` will optimize "I +_nuw C < L ==> I < L"
only if C is positive. This is an unnecessary restriction -- the
implication holds even if `C` is negative.
Reviewers: reames, majnemer
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D14369
llvm-svn: 252332
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index 3dc9f3a1037..f4824aebe52 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -4109,12 +4109,12 @@ static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS) { case CmpInst::ICMP_ULE: { ConstantInt *CI; - // LHS u< LHS +_{nuw} C if C > 0 - // LHS u<= LHS +_{nuw} C if C >= 0 + // LHS u< LHS +_{nuw} C if C != 0 + // LHS u<= LHS +_{nuw} C if (match(RHS, m_NUWAdd(m_Specific(LHS), m_ConstantInt(CI)))) { if (Pred == CmpInst::ICMP_ULT) - return CI->getValue().isStrictlyPositive(); - return !CI->isNegative(); + return !CI->isZero(); + return true; } return false; } |