When the two operands of an icmp are equal, there are five possible predicates
that would make the icmp true. Fixes PR1637.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@41740 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 9db1034..58eb3bc 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -4563,7 +4563,9 @@
       if (NumDifferences == 0)   // SAME GEP?
         return ReplaceInstUsesWith(I, // No comparison is needed here.
                                    ConstantInt::get(Type::Int1Ty, 
-                                                    Cond == ICmpInst::ICMP_EQ));
+                                                    Cond == ICmpInst::ICMP_EQ ||
+                     Cond == ICmpInst::ICMP_ULE || Cond == ICmpInst::ICMP_UGE ||
+                     Cond == ICmpInst::ICMP_SLE || Cond == ICmpInst::ICMP_SGE));
       else if (NumDifferences == 1) {
         Value *LHSV = GEPLHS->getOperand(DiffOperand);
         Value *RHSV = GEPRHS->getOperand(DiffOperand);