Skip to content

Commit 883ebcc

Browse files
committed
auto merge of #8700 : alexcrichton/rust/better-llvm, r=thestinger
Beforehand, it was unclear whether rust was performing the "recommended set" of optimizations provided by LLVM for code. This commit changes the way we run passes to closely mirror that of clang, which in theory does it correctly. The notable changes include: * Passes are no longer explicitly added one by one. This would be difficult to keep up with as LLVM changes and we don't guaranteed always know the best order in which to run passes * Passes are now managed by LLVM's PassManagerBuilder object. This is then used to populate the various pass managers run. * We now run both a FunctionPassManager and a module-wide PassManager. This is what clang does, and I presume that we *may* see a speed boost from the module-wide passes just having to do less work. I have no measured this. * The codegen pass manager has been extracted to its own separate pass manager to not get mixed up with the other passes * All pass managers now include passes for target-specific data layout and analysis passes Some new features include: * You can now print all passes being run with `-Z print-llvm-passes` * When specifying passes via `--passes`, the passes are now appended to the default list of passes instead of overwriting them. * The output of `--passes list` is now generated by LLVM instead of maintaining a list of passes ourselves * Loop vectorization is turned on by default as an optimization pass and can be disabled with `-Z no-vectorize-loops` All of these "copies" of clang are based off their [source code](http://clang.llvm.org/doxygen/BackendUtil_8cpp_source.html) in case anyone is curious what my source is. I was hoping that this would fix #8665, but this does not help the performance issues found there. Hopefully i'll allow us to tweak passes or see what's going on to try to debug that problem.
2 parents 491bc35 + 50369bb commit 883ebcc

File tree

12 files changed

+459
-758
lines changed

12 files changed

+459
-758
lines changed

src/librustc/back/link.rs

+155-179
Large diffs are not rendered by default.

src/librustc/back/passes.rs

-349
This file was deleted.

src/librustc/driver/driver.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -848,8 +848,9 @@ pub fn optgroups() -> ~[getopts::groups::OptGroup] {
848848
optopt("", "opt-level",
849849
"Optimize with possible levels 0-3", "LEVEL"),
850850
optopt("", "passes", "Comma or space separated list of pass names to use. \
851-
Overrides the default passes for optimization levels,\n\
852-
a value of \"list\" will list the available passes.", "NAMES"),
851+
Appends to the default list of passes to run for the \
852+
specified current optimization level. A value of \
853+
\"list\" will list all of the available passes", "NAMES"),
853854
optopt( "", "out-dir",
854855
"Write output to compiler-chosen filename
855856
in <dir>", "DIR"),

0 commit comments

Comments
 (0)