[llvm-commits] [llvm] r159082 - /llvm/trunk/lib/Target/README.txt

Nick Lewycky nicholas at mxc.ca
Sat Jun 23 19:36:14 PDT 2012


Duncan Sands wrote:
> Hi Benjamin,
>
>   >  +unsigned f(unsigned x) { return ((x&  7) + 1)&  15; }
>> +The&  15 part should be optimized away, it doesn't change the result. Currently
>> +not optimized with "clang -emit-llvm-bc | opt -std-compile-opts".
>
> this is probably due to ComputeMaskedBits's "add" logic being pretty weak.  It
> could easily be made essentially perfect.

GCC's version of ComputeMaskedBits gets perfect results for "add". I 
would ask that you add matching logic for SimplifyDemandedBits when you 
add this, and that isn't quite possible in constant time like it is for 
computing masked bits as it requires bitwise-reversing the bits of the 
operands.

I think Richard has a patch for this. Richard?

Nick



More information about the llvm-commits mailing list