[llvm-commits] [llvm] r126991 - in /llvm/trunk: lib/Analysis/InstructionSimplify.cpp test/Transforms/InstCombine/icmp.ll test/Transforms/InstSimplify/compare.ll

Duncan Sands baldrick at free.fr
Fri Mar 4 06:23:19 PST 2011


Hi Nick,

> +  if (LBO&&  match(LBO, m_SRem(m_Value(), m_Specific(RHS)))) {
> +    switch (Pred) {
> +    default:
> +      break;
> +    case ICmpInst::ICMP_EQ:
> +    case ICmpInst::ICMP_SGT:
> +    case ICmpInst::ICMP_SGE:
> +      return ConstantInt::getFalse(RHS->getContext());

consider (3 srem -5) sge -5.  This is true but your logic returns false...

> +    case ICmpInst::ICMP_NE:
> +    case ICmpInst::ICMP_SLT:
> +    case ICmpInst::ICMP_SLE:
> +      return ConstantInt::getTrue(RHS->getContext());
> +    }
> +  }

A similar example applies.  What is true is that |x srem y| < |y|.

Ciao, Duncan.



More information about the llvm-commits mailing list