[LLVMdev] Simplifying boolean expressions

Chris Lattner sabre at nondot.org
Wed May 4 07:34:25 PDT 2005


On Wed, 4 May 2005, Vladimir Prus wrote:
>
>       %tmp.aux = cast bool %tmp.24 to int
>        %tmp.x = xor int  %tmp.aux, 1                    ; negates tmp.24
>        %tmp.xx = cast int %tmp.x to bool
>        %tmp.y = or bool %tmp.xx, %tmp.24          ;  will be always true
>        br bool %tmp.y, label %next6, label %next7
>
> Is there an optimization in LLVM that will recognize that %tmp.y is always
> true, and replace the entire basic block with unconditional jump?

Actually, the -instcombine pass already does this.  Please try it out and 
let me know if it doesn't do what you want.

-Chris

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




More information about the llvm-dev mailing list