diff options
author | Jakub Staszak <kubastaszak@gmail.com> | 2012-12-31 18:26:42 +0000 |
---|---|---|
committer | Jakub Staszak <kubastaszak@gmail.com> | 2012-12-31 18:26:42 +0000 |
commit | 526057921dcb57e0d51d60ddb0f5ce16596c307f (patch) | |
tree | e2b75d18c765f167faa1b0aebe2592c8c0c372dd /lib | |
parent | 5b712efd9a4d29119ce136d46a23454bdc103f68 (diff) |
Add extra CHECK to make sure that 'or' instruction was replaced.
Also add an assert to avoid confusion in the code where is known that C1 <= C2.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@171310 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineAndOrXor.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp index ab75318eaa..fac035e7ef 100644 --- a/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp +++ b/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp @@ -1528,6 +1528,8 @@ Value *InstCombiner::FoldOrOfICmps(ICmpInst *LHS, ICmpInst *RHS) { if (LHS->getOperand(0) == RHS->getOperand(0)) { // if LHSCst and RHSCst differ only by one bit: // (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1 + assert(LHSCst->getValue().ule(LHSCst->getValue())); + APInt Xor = LHSCst->getValue() ^ RHSCst->getValue(); if (Xor.isPowerOf2()) { Value *NegCst = Builder->getInt(~Xor); |