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

Nick Lewycky nicholas at mxc.ca
Fri Mar 4 11:25:21 PST 2011


Duncan Sands wrote:
> 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...

Sigh. I put all this thought into cases like X srem Y sge -Y, but 
totally missed that. I'll revert as soon as I verify that make check 
passes. Thanks!

Nick

>
>> +    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.
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list