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);
--- /dev/null
+; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep {ret i1 true}
+; PR1637
+
+define i1 @f(i8* %arr) {
+ %X = getelementptr i8* %arr, i32 1
+ %Y = getelementptr i8* %arr, i32 1
+ %test = icmp uge i8* %X, %Y
+ ret i1 %test
+}
+