[LLVMdev] Re: Preferring cast over seteq with 0

Chris Lattner sabre at nondot.org
Thu May 19 14:17:25 PDT 2005


On Thu, 19 May 2005, Eric Zimmerman wrote:
> 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.

I think that the instcombine pass should take care of this situation.  Do 
you have a simple testcase that shows the problem?

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list