<div dir="ltr">Yeah, it's a pretty sad state of affairs. Hopefully the new pass manager will help in this regard (or at least bring the extent of yaks into the light).</div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Jan 5, 2015 at 1:33 PM, Duncan P. N. Exon Smith <span dir="ltr"><<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Some of those passes can't be specified on the command-line; they're<br>
implicitly added by other passes.<br>
<br>
I usually remove the passes that `opt` complains about and things<br>
still reproduce.<br>
<div class="HOEnZb"><div class="h5"><br>
> On 2015-Jan-05, at 13:29, David Callahan <<a href="mailto:dcallahan@fb.com">dcallahan@fb.com</a>> wrote:<br>
><br>
> Thanks to you both.<br>
><br>
> On my Linux (centos6) system, I have reproduce a variant of the bug and learned about<br>
>    -plugin-opt=-debug-pass=Arguments<br>
> which I infer from comments is intended to built arguments to “opt” however I found that some of the arguments don’t seem to be quite correct. I assume this just minor bit rot.<br>
><br>
>  bin/opt -o pass1.bc -datalayout -notti -basictti -x86tti -targetlibinfo -no-aa -tbaa -scoped-noalias -assumption-tracker -basicaa -verify -verify-di -ipsccp -globalopt -c\<br>
> onstmerge -deadargelim -instcombine -basiccg -inline-cost -inline -prune-eh -globalopt -globaldce -basiccg -argpromotion -instcombine -lazy-value-info -jump-threading -domt\<br>
> ree -sroa -basiccg -functionattrs -globalsmodref-aa -domtree -loops -loop-simplify -lcssa -licm -memdep -mldst-motion -domtree -memdep -gvn -memdep -memcpyopt -dse -loops -\<br>
> scalar-evolution -loop-simplify -lcssa -indvars -loop-deletion -branch-prob -block-freq -loop-vectorize -scalar-evolution -alignment-from-assumptions -instcombine -lazy-val\<br>
> ue-info -jump-threading -simplifycfg -globaldce -verify -verify-di bug17623a.o<br>
> opt: Unknown command line argument '-basictti'.  Try: 'bin/opt -help'<br>
> opt: Did you mean '-basiccg'?<br>
> opt: Unknown command line argument '-x86tti'.  Try: 'bin/opt -help'<br>
> opt: Did you mean '-notti'?<br>
> opt: Unknown command line argument '-verify-di'.  Try: 'bin/opt -help'<br>
> opt: Did you mean '-verify'?<br>
> opt: Unknown command line argument '-verify-di'.  Try: 'bin/opt -help'<br>
> opt: Did you mean '-verify'?<br>
><br>
><br>
> On 1/5/15, 1:16 PM, "Duncan P. N. Exon Smith" <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br>
><br>
><br>
> On 2015-Jan-05, at 01:14, Bill Wendling <<a href="mailto:isanbard@gmail.com">isanbard@gmail.com</a>> wrote:<br>
> On Jan 3, 2015, at 11:52 PM, Bill Wendling <<a href="mailto:isanbard@gmail.com">isanbard@gmail.com</a>> wrote:<br>
> On Jan 2, 2015, at 8:32 PM, David Callahan <<a href="mailto:dcallahan@fb.com">dcallahan@fb.com</a>> wrote:<br>
> Hi,<br>
><br>
> I am new to the LLVM dev community so forgive a perhaps obvious question. I am looking at bug 17623 which is an LTO/optimizer interaction bug.  I am working on a Mac with Xcode installed but have also built the 3.6 LLVM binaries (from a few month old local branch).<br>
><br>
> The default version of “ld” from Apple supports an option “-save-temps” which I believe saves bitcode both before and after the optimizer (and the bug is visible as a difference between these two)<br>
><br>
> ~/llvm-install/bin/clang -flto -O2 -c -o bug17623.o bug17623.c<br>
> "/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -lSystem /Users/dcallahan/llvm-install/bin/..\<br>
> /lib/clang/3.6.0/lib/darwin/libclang_rt.osx.a -save-temps -o bug36 bug17623.o<br>
><br>
> (this produces bug36.lto.bc and bug36.lto.opt.bc)<br>
><br>
> However, if I use “opt” to try and duplicate the actions run by “ld”, as in:<br>
><br>
> ~/llvm-install/bin/opt -O2 -o bug36.opt.bc bug36.lto.bc<br>
><br>
> This generates a different (much cleaner and correct!) output.<br>
><br>
> So my questions are:<br>
> 1.     Is it feasible to get “opt” to reproduce the behavior of “ld”?<br>
> The optimizations that occur during LTO (the ‘ld’ command) are different from the “normal” optimizations that opt runs. For one, LLVM has a view of the whole program, not just one compilation unit at a time. If you want to look at some of the optimizations that it performs, you can use the “opt -std-link-opts” command.<br>
> 2.     Assuming I am just missing some parameters to “opt”, how do I determine what they should be?<br>
> The link time optimizations are enabled via the "-std-link-opts” option.<br>
><br>
> You might also need to add `-internalize-public-api-list` to prevent<br>
> functions like `main()` from getting internalized (and dead-stripped).<br>
><br>
> I forgot to mention that you will need to link all of the .bc files together using 'llvm-link’ before you run ‘opt -std-link-opts’ on it.<br>
><br>
> (If you're starting from bug36.lto.bc then they've already been linked.)<br>
<br>
<br>
</div></div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
</div></div></blockquote></div><br></div>