summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-12-20 20:00:31 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-12-20 20:00:31 +0000
commitf7957d04639baf1eb85d9de7c849c76f40dda019 (patch)
tree04190265b4a95c65c4fcd3452010b2417f08e22e /llvm
parent8e37ea1a29ccbad4e5a6e83a3fda1608074f0402 (diff)
downloadbcm5719-llvm-f7957d04639baf1eb85d9de7c849c76f40dda019.tar.gz
bcm5719-llvm-f7957d04639baf1eb85d9de7c849c76f40dda019.zip
Add a check missing from my last commit and avoid a potential overflow situation.
llvm-svn: 122258
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
index 074f6610c47..64613b186e8 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
@@ -1449,13 +1449,13 @@ Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS) {
}
}
- // (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ult (X + CA), C1 + 1)
+ // (icmp ult (X + CA), C1) | (icmp eq X, C2) -> (icmp ule (X + CA), C1)
// iff C2 + CA == C1.
- if (LHSCC == ICmpInst::ICMP_ULT) {
+ if (LHSCC == ICmpInst::ICMP_ULT && RHSCC == ICmpInst::ICMP_EQ) {
ConstantInt *AddCst;
if (match(Val, m_Add(m_Specific(Val2), m_ConstantInt(AddCst))))
if (RHSCst->getValue() + AddCst->getValue() == LHSCst->getValue())
- return Builder->CreateICmp(LHSCC, Val, AddOne(LHSCst));
+ return Builder->CreateICmpULE(Val, LHSCst);
}
// From here on, we only handle:
OpenPOWER on IntegriCloud