Auto merge of #22530 - rprichard:master, r=dotdash

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.
This commit is contained in:
bors 2015-02-24 20:57:31 +00:00
commit ad04cce61c
2 changed files with 7 additions and 1 deletions

View file

@ -167,7 +167,12 @@ pub fn run(sess: &session::Session, llmod: ModuleRef,
llvm::LLVMRustAddAnalysisPasses(tm, pm, llmod);
llvm::LLVMRustAddPass(pm, "verify\0".as_ptr() as *const _);
let opt = sess.opts.cg.opt_level.unwrap_or(0) as libc::c_uint;
let opt = match sess.opts.optimize {
config::No => 0,
config::Less => 1,
config::Default => 2,
config::Aggressive => 3,
};
let builder = llvm::LLVMPassManagerBuilderCreate();
llvm::LLVMPassManagerBuilderSetOptLevel(builder, opt);

View file

@ -14,6 +14,7 @@
// aux-build:sepcomp_lib.rs
// compile-flags: -C lto
// no-prefer-dynamic
// ignore-android FIXME #18800
extern crate sepcomp_lib;
use sepcomp_lib::a::one;