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

Duncan Sands baldrick at free.fr
Wed Mar 9 00:09:26 PST 2011


Hi Nick,

> Add another micro-optimization. Apologies for the lack of refactoring, but I
> gave up when I realized I couldn't come up with a good name for what the
> refactored function would be, to describe what it does.

> +    case ICmpInst::ICMP_EQ:

EQ -> return false

> +    case ICmpInst::ICMP_UGT:
> +    case ICmpInst::ICMP_UGE:
> +      return ConstantInt::getTrue(RHS->getContext());
> +    case ICmpInst::ICMP_SLT:
> +    case ICmpInst::ICMP_SLE:
> +      ComputeSignBit(RHS, KnownNonNegative, KnownNegative, TD);
> +      if (!KnownNonNegative)
> +        break;
> +      // fall-through
> +    case ICmpInst::ICMP_NE:

NE -> return true

> +    case ICmpInst::ICMP_ULT:
> +    case ICmpInst::ICMP_ULE:
> +      return ConstantInt::getFalse(RHS->getContext());
> +    }
> +  }

Ciao, Duncan.



More information about the llvm-commits mailing list