-
Notifications
You must be signed in to change notification settings - Fork 13.3k
-C lto -O does not enable LLVM optimizations for the LTO passes #22525
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Labels
I-slow
Issue: Problems and improvements with respect to performance of generated code.
Comments
Nice find! Probably not noticed by many because those using |
I'd be happy to make a PR, though I probably won't get to it until tomorrow. |
rprichard
added a commit
to rprichard/rust
that referenced
this issue
Feb 19, 2015
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
Feb 19, 2015
Fixes rust-lang#22525 I wasn't sure if I should reuse `write::get_llvm_opt_level` or not. It returns an `llvm::CodeGenOptLevel`, which is the Rust binding for `CodeGenOpt::Level`. `lto.rs` is passing an optlevel to LLVM's `PassManagerBuilder`, which takes an unsigned int. `PassManagerBuilder`'s optlevel uses essentially the same enumeration (i.e. 0-3 with 2 as default), but it's implicit.
bors
added a commit
that referenced
this issue
Feb 24, 2015
Fixes #22525 I wasn't sure if I should reuse `write::get_llvm_opt_level` or not. It returns an `llvm::CodeGenOptLevel`, which is the Rust binding for `CodeGenOpt::Level`. `lto.rs` is passing an optlevel to LLVM's `PassManagerBuilder`, which takes an unsigned int. `PassManagerBuilder`'s optlevel uses essentially the same enumeration (i.e. 0-3 with 2 as default), but it's implicit.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-O
seems to function like an alias for-C opt-level=2
, but-O
does not enable certain LTO LLVM optimizations (inlining?), whereas-C opt-level=2
does. This seems like a mistake.The problem is this code in
librustc_trans/back/lto.rs
:sess.opts.cg.opt_level
is the-C opt-level
setting, which isNone
with-O
.test.rs:
output:
I think we should base the LLVM optimization level on
sess.opts.optimize
. (Maybe it ought to usewrite::get_llvm_opt_level
?)The text was updated successfully, but these errors were encountered: