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

Duncan Sands baldrick at free.fr
Fri Mar 4 06:11:53 PST 2011


Hi Nick, nice patch!

> +    // Many binary operators with constant RHS have easy to compute constant
> +    // range.  Use them to check whether the comparison is a tautology.

Why restrict yourself to a constant right hand side?  For example, consider
(x urem y) <=u z.  If y <=u z simplifies to true then the original simplifies
to true.  I think this would catch a strict superset of what your patch catches.
On the other hand it is more complicated to implement (urem is perhaps the
simplest case) and may not bring much benefit.

> +    uint32_t Width = CI->getBitWidth();
> +    APInt Lower = APInt(Width, 0);
> +    APInt Upper = APInt(Width, 0);

I think you should add a comment explaining that you are considering the range
[Lower, Upper), and that this range is for LHS.

Ciao, Duncan.



More information about the llvm-commits mailing list