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

Duncan Sands baldrick at free.fr
Thu Jul 8 08:10:11 PDT 2010


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.

maybe this is a sign that it should be a DAGCombiner optimization rather
than an instcombine one?

Ciao,

Duncan.

I don't think xor is profitable
> unless we extend the optimization to transform non-const C1 and C2 too.





More information about the llvm-commits mailing list