On Dec 27, 2007, at 11:42 PM, Owen Anderson wrote: > URL: http://llvm.org/viewvc/llvm-project?rev=45384&view=rev > Log: > Repair a transform that Chris noticed a bug in. Thanks to Nicholas > for pointing out my stupid mistakes when writing this patch. :-)
Thanks Owen! A minor tweak: > = > = > = > = > = > = > = > = > ====================================================================== > --- llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp > (original) > +++ llvm/trunk/lib/Transforms/Scalar/InstructionCombining.cpp Fri > Dec 28 01:42:12 2007 > @@ -4835,11 +4835,18 @@ > if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) { > Value *A, *B; > > + // (icmp cond (sub A B) 0) -> ... > + if (CI->isNullValue() && match(Op0, m_Sub(m_Value(A), > m_Value(B)))) { > + // (icmp cond A B) if cond is signed or equality > + if (CmpInst::isSigned(I.getPredicate()) || I.isEquality()) > + return new ICmpInst(I.getPredicate(), A, B); > + // (icmp ne A B) if cond is ugt > + else if (I.getPredicate() == ICmpInst::ICMP_UGT) > + return new ICmpInst(ICmpInst::ICMP_NE, A, B); > + // (icmp eq A B) if cond is ule > + else if (I.getPredicate() == ICmpInst::ICMP_ULE) > + return new ICmpInst(ICmpInst::ICMP_EQ, A, B); > + } Why not handle UGE and ULT? If it is handled elsewhere, please add a comment to that effect, thanks! -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits