summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-11-11 00:16:41 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-11-11 00:16:41 +0000
commitdc26df4abe083a4ac9b8f53c847194479e5a458a (patch)
treeef8527d47e292b98d1ab5236d562bd241d2fa5d1 /llvm/lib
parent61cb6fa848bb0b598d9ab34275ff714444d42b5e (diff)
downloadbcm5719-llvm-dc26df4abe083a4ac9b8f53c847194479e5a458a.tar.gz
bcm5719-llvm-dc26df4abe083a4ac9b8f53c847194479e5a458a.zip
[ValueTracking] Remove untested / unreachable code, NFC
Right now isTruePredicate is only ever called with Pred == ICMP_SLE or ICMP_ULE, and the ICMP_SLT and ICMP_ULT cases are dead. This change removes the untested dead code so that the function is not misleading. llvm-svn: 252676
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp23
1 files changed, 5 insertions, 18 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index f851892d3d3..b2a1034eeaa 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4111,31 +4111,21 @@ static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS,
default:
return false;
- case CmpInst::ICMP_SLT:
case CmpInst::ICMP_SLE: {
const APInt *C;
- // LHS s< LHS +_{nsw} C if C > 0
// LHS s<= LHS +_{nsw} C if C >= 0
- if (match(RHS, m_NSWAdd(m_Specific(LHS), m_APInt(C)))) {
- if (Pred == CmpInst::ICMP_SLT)
- return C->isStrictlyPositive();
+ if (match(RHS, m_NSWAdd(m_Specific(LHS), m_APInt(C))))
return !C->isNegative();
- }
return false;
}
- case CmpInst::ICMP_ULT:
case CmpInst::ICMP_ULE: {
const APInt *C;
- // LHS u< LHS +_{nuw} C if C != 0
- // LHS u<= LHS +_{nuw} C
- if (match(RHS, m_NUWAdd(m_Specific(LHS), m_APInt(C)))) {
- if (Pred == CmpInst::ICMP_ULT)
- return C->isMinValue();
+ // LHS u<= LHS +_{nuw} C for any C
+ if (match(RHS, m_NUWAdd(m_Specific(LHS), m_APInt(C))))
return true;
- }
// Match A to (X +_{nuw} CA) and B to (X +_{nuw} CB)
auto MatchNUWAddsToSameValue = [&](Value *A, Value *B, Value *&X,
@@ -4160,11 +4150,8 @@ static bool isTruePredicate(CmpInst::Predicate Pred, Value *LHS, Value *RHS,
Value *X;
const APInt *CLHS, *CRHS;
- if (MatchNUWAddsToSameValue(LHS, RHS, X, CLHS, CRHS)) {
- if (Pred == CmpInst::ICMP_ULE)
- return CLHS->ule(*CRHS);
- return CLHS->ult(*CRHS);
- }
+ if (MatchNUWAddsToSameValue(LHS, RHS, X, CLHS, CRHS))
+ return CLHS->ule(*CRHS);
return false;
}
OpenPOWER on IntegriCloud