[llvm-commits] [llvm] r128731 - in /llvm/trunk/lib/Transforms/InstCombine: InstCombine.h InstCombineCasts.cpp

Frits van Bommel fvbommel at gmail.com
Fri Apr 1 14:51:37 PDT 2011


I know you only moved this code, but I still have some comments on it:

On Fri, Apr 1, 2011 at 10:09 PM, Benjamin Kramer
<benny.kra at googlemail.com> wrote:
> +    // (x <s 0) ? -1 : 0 -> ashr x, 31   -> all ones if signed
> +    // (x >s -1) ? -1 : 0 -> ashr x, 31  -> all ones if not signed

The second comment line is incorrect. The ashr should be 'not (ashr x, 31)'.

> +    if ((Pred == ICmpInst::ICMP_SLT && Op1C->isZero()) ||
> +        (Pred == ICmpInst::ICMP_SGT && Op1C->isAllOnesValue())) {

It seems to me that this can also be done for (x <u signbit) and (x >u
signed_max). Unless those are canonicalized to signed comparisons
elsewhere?




More information about the llvm-commits mailing list