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).
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)
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).
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)
This generates a different (much cleaner and correct!) output.
So my questions are:
Is it feasible to get “opt” to reproduce the behavior of “ld”?
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.
Assuming I am just missing some parameters to “opt”, how do I determine what they should be?
The link time optimizations are enabled via the "-std-link-opts” option.
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).
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)
This generates a different (much cleaner and correct!) output.
So my questions are:
1. Is it feasible to get “opt” to reproduce the behavior of “ld”?
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.
2. Assuming I am just missing some parameters to “opt”, how do I determine what they should be?
The link time optimizations are enabled via the "-std-link-opts” option.
You might also need to add `-internalize-public-api-list` to prevent
functions like `main()` from getting internalized (and dead-stripped).
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.
(If you're starting from bug36.lto.bc then they've already been linked.)
On my Linux (centos6) system, I have reproduce a variant of the bug and learned about
-plugin-opt=-debug-pass=Arguments
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.
bin/opt -o pass1.bc -datalayout -notti -basictti -x86tti -targetlibinfo -no-aa -tbaa -scoped-noalias -assumption-tracker -basicaa -verify -verify-di -ipsccp -globalopt -c
onstmerge -deadargelim -instcombine -basiccg -inline-cost -inline -prune-eh -globalopt -globaldce -basiccg -argpromotion -instcombine -lazy-value-info -jump-threading -domt
ree -sroa -basiccg -functionattrs -globalsmodref-aa -domtree -loops -loop-simplify -lcssa -licm -memdep -mldst-motion -domtree -memdep -gvn -memdep -memcpyopt -dse -loops -
scalar-evolution -loop-simplify -lcssa -indvars -loop-deletion -branch-prob -block-freq -loop-vectorize -scalar-evolution -alignment-from-assumptions -instcombine -lazy-val
ue-info -jump-threading -simplifycfg -globaldce -verify -verify-di bug17623a.o
opt: Unknown command line argument ‘-basictti’. Try: ‘bin/opt -help’
opt: Did you mean ‘-basiccg’?
opt: Unknown command line argument ‘-x86tti’. Try: ‘bin/opt -help’
opt: Did you mean ‘-notti’?
opt: Unknown command line argument ‘-verify-di’. Try: ‘bin/opt -help’
opt: Did you mean ‘-verify’?
opt: Unknown command line argument ‘-verify-di’. Try: ‘bin/opt -help’
opt: Did you mean ‘-verify’?
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).