[llvm-commits] [llvm] r122258 - /llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Dec 20 12:00:31 PST 2010
Author: d0k
Date: Mon Dec 20 14:00:31 2010
New Revision: 122258
URL: http://llvm.org/viewvc/llvm-project?rev=122258&view=rev
Log:
Add a check missing from my last commit and avoid a potential overflow situation.
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=122258&r1=122257&r2=122258&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Dec 20 14:00:31 2010
@@ -1449,13 +1449,13 @@
}
}
- // (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:
More information about the llvm-commits
mailing list