<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Dec 7, 2015 at 1:41 PM, Phil Tomson <span dir="ltr"><<a href="mailto:phil.a.tomson@gmail.com" target="_blank">phil.a.tomson@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div>I'm working on LLVM for a new target processor and we've got a testcase that fails with -O2 optimization is used. So I figured I'd figure out what optimizations are being applied with -O2 using:<br><br> $TG_BIN/opt -O2 -disable-output -debug-pass=Arguments some.bc<br><br></div>then I figured I'd pass these to opt and remove one for each run until, though process of elimination, I had found the offending optimization.<br><br></div>However, when I pass the full list of optimizations returned from that command above, I find that our test passes. <br><br></div>Previously we were running the following in our Makefile to get the .o for the testcase (that was then later linked):<br><br>     $(CC) $(CFLAGS) -fno-builtin -c $< -o $@ <br><br></div>(where CC=clang and CFAGS=-O2<br><br></div>Now I'm running:<br><br>      $(CC) -emit-llvm $(CFLAGS) -fno-builtin -c $< -o $(basename $<).bc<br>      $(OPT) $(OPTS) -o $(basename $<).opt.bc $(basename $<).bc<br>      $(LLC) $(basename $<).bc -o $(basename $<).s   <br>      $(AS) $(basename $<).s -o $@ <br></div></div></div></blockquote><div><br></div><div>Apologies, I had a typo there,should have been:<br><br>        $(LLC) $(basename $<).opt.bc -o $(basename $<).s   <br><br></div><div>...no it fails as expected.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><div><br></div>Where OPTS is: <br><br>     -datalayout -notti -no-aa -tbaa -scoped-noalias -assumption-cache-tracker -targetlibinfo -basicaa -verify -simplifycfg -domtree -sroa -early-cse -lower-expect -ipsccp -globalopt -deadargelim -instcombine -basiccg -prune-eh -inline-cost -inline -functionattrs -lazy-value-info -jump-threading -correlated-propagation -tailcallelim -reassociate -loops -loop-simplify -lcssa -loop-rotate -licm -loop-unswitch -scalar-evolution -indvars -loop-idiom -loop-deletion -function_tti -loop-unroll -memdep -mldst-motion -gvn -memcpyopt -sccp -dse -adce -barrier -branch-prob -block-freq -loop-vectorize -slp-vectorizer -alignment-from-assumptions -strip-dead-prototypes -globaldce -constmerge<br><br></div>So I'm wondering why the former (passing the -O2 to clang) is failing while the latter passes our tests. Is there something I'm missing from the list of -O2 optimizations?<br><br><br><div><div><div><div><br><br></div></div></div></div></div>
</blockquote></div><br></div></div>