[llvm-commits] [PATCH] Add a instcombine optimization.

Benjamin Kramer benny.kra at googlemail.com
Thu Jul 8 04:40:32 PDT 2010


On 08.07.2010, at 13:29, Benjamin Kramer wrote:

> 
> On 08.07.2010, at 09:12, Duncan Sands wrote:
> 
>> Hi Benjamin,
>> 
>>> The attached patch adds a new transformation to instcombine:
>>> (X>s -1) ? C1 : C2 -->  ((X>>s 31)&  (C2 - C1)) + C1
>> 
>> how about (X >s -1) ? C1 : C2 -->  ((X >>s 31) & (C2 xor C1)) xor C1
>> instead?  It might interact better with other bit fiddling optimizations.
>> Otherwise the patch looks good.
> 
> Hmm, but we wont get a lea on x86 with xor. I don't think xor is profitable
> unless we extend the optimization to transform non-const C1 and C2 too.

I committed the patch along with a FIXME about xor in r107866.



More information about the llvm-commits mailing list