[LLVMdev] Re: Preferring cast over seteq with 0

Eric Zimmerman ezimmerm at uiuc.edu
Thu May 19 13:49:06 PDT 2005


On Thu, May 19, 2005 at 03:27:02PM -0500, Eric Zimmerman wrote:
> Is there a pass that will transform this:
>   %cc = seteq ushort %val, 0    
> 
> into this:
>   %cc = cast ushort %val to bool
> 
> Would instcombine be the logical place to do this?  

In my situation, this bool value feeds a select instruction.  Because
casting inverts the condition, the select would have to switch the
operands, but I think it would be beneficial. 




More information about the llvm-dev mailing list