On Wednesday 04 May 2005 18:34, Chris Lattner wrote:> 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.It does work! For some reason, I was assuming that running 'opt' without arguments would run some "reasonable" set of optimizations, while in reality, it does not run any. Thanks, Volodya
On Thu, May 05, 2005 at 09:47:50AM +0400, Vladimir Prus wrote:> > Actually, the -instcombine pass already does this. Please try it > > out and let me know if it doesn't do what you want. > > It does work! For some reason, I was assuming that running 'opt' > without arguments would run some "reasonable" set of optimizations, > while in reality, it does not run any.I was afraid you were doing "opt < file.bc > out.bc" but I assumed that you were actually using some switches with opt. :) Yes, without any command-line switches it's a noop. If you're looking for the "standard" optimizations, you want to use gccas and/or gccld. -- Misha Brukman :: http://misha.brukman.net :: http://llvm.cs.uiuc.edu
On Thu, 2005-05-05 at 02:25 -0500, Misha Brukman wrote:> On Thu, May 05, 2005 at 09:47:50AM +0400, Vladimir Prus wrote: > > > Actually, the -instcombine pass already does this. Please try it > > > out and let me know if it doesn't do what you want. > > > > It does work! For some reason, I was assuming that running 'opt' > > without arguments would run some "reasonable" set of optimizations, > > while in reality, it does not run any. > > I was afraid you were doing "opt < file.bc > out.bc" but I assumed that > you were actually using some switches with opt. :) > > Yes, without any command-line switches it's a noop. If you're looking > for the "standard" optimizations, you want to use gccas and/or gccld. >Actually, that's not exactly true. opt always runs the verify pass to verify that the constructed module is sane. That pass, however, does no optimization. Reid. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050505/a1b9d32c/attachment-0001.sig>