You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
-C lto -O does not enable LLVM optimizations for the LTO passes #22525
-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:
let opt = sess.opts.cg.opt_level.unwrap_or(0) as libc::c_uint;
let builder = llvm::LLVMPassManagerBuilderCreate();
llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt);
llvm::LLVMPassManagerBuilderPopulateLTOPassManager(builder, pm,
/* Internalize = */ False,
/* RunInliner = */ True);
llvm::LLVMPassManagerBuilderDispose(builder);
sess.opts.cg.opt_level is the -C opt-level setting, which is None with -O.
Activity
dotdash commentedon Feb 19, 2015
Nice find! Probably not noticed by many because those using
-C ltoalso go straight to-C opt-level=3as well. Do you want to make a PR to fix this?rprichard commentedon Feb 19, 2015
I'd be happy to make a PR, though I probably won't get to it until tomorrow.
Use sess.opts.optimize instead of sess.opts.cg.opt_level for LTO optl…
Merge pull request rust-lang#22525 from Veykril/push-wympnqnklmvy