[LLVMdev] Preferring cast over seteq with 0

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


On Thu, 19 May 2005, 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?

Actually the instcombine pass canonicalizes the other way, turning (cast X 
to bool) -> (X != 0).  Does this not work for you?

-Chris

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




More information about the llvm-dev mailing list