diff options
| author | Chris Lattner <sabre@nondot.org> | 2011-01-15 05:41:33 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2011-01-15 05:41:33 +0000 |
| commit | f3c4eefff8b97117d6ba0ab5ecfcc574d2166c23 (patch) | |
| tree | 33c12b7adeec527db5738f8906adf92d376879bc /llvm/lib | |
| parent | 311aa63c8700fdaf20ee922f58bd3cc0bb92e3fd (diff) | |
| download | bcm5719-llvm-f3c4eefff8b97117d6ba0ab5ecfcc574d2166c23.tar.gz bcm5719-llvm-f3c4eefff8b97117d6ba0ab5ecfcc574d2166c23.zip | |
Catch ~x < cst just like ~x < ~y, we currently handle this through
means that are about to disappear.
llvm-svn: 123515
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp index bd339742ef2..220601611d7 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp @@ -2284,11 +2284,15 @@ Instruction *InstCombiner::visitICmpInst(ICmpInst &I) { } } - // ~x < ~y --> y < x { Value *A, *B; - if (match(Op0, m_Not(m_Value(A))) && - match(Op1, m_Not(m_Value(B)))) - return new ICmpInst(I.getPredicate(), B, A); + // ~x < ~y --> y < x + // ~x < cst --> ~cst < x + if (match(Op0, m_Not(m_Value(A)))) { + if (match(Op1, m_Not(m_Value(B)))) + return new ICmpInst(I.getPredicate(), B, A); + if (ConstantInt *RHSC = dyn_cast<ConstantInt>(B)) + return new ICmpInst(I.getPredicate(), ConstantExpr::getNot(RHSC), A); + } // (a+b) <u a --> llvm.uadd.with.overflow. // (a+b) <u b --> llvm.uadd.with.overflow. |

