forked from M-Labs/nac3
meta: Respect opt flags when performing whole-module optimization
This commit is contained in:
parent
b39831b388
commit
2a38d5160e
|
@ -660,7 +660,8 @@ impl Nac3 {
|
||||||
|
|
||||||
let pass_options = PassBuilderOptions::create();
|
let pass_options = PassBuilderOptions::create();
|
||||||
pass_options.set_merge_functions(true);
|
pass_options.set_merge_functions(true);
|
||||||
let result = main.run_passes("default<O3>", &target_machine, pass_options);
|
let passes = format!("default<O{}>", self.llvm_options.opt_level as u32);
|
||||||
|
let result = main.run_passes(passes.as_str(), &target_machine, pass_options);
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
panic!("Failed to run optimization for module `main`: {}", err.to_string());
|
panic!("Failed to run optimization for module `main`: {}", err.to_string());
|
||||||
}
|
}
|
||||||
|
|
|
@ -328,7 +328,6 @@ impl WorkerRegistry {
|
||||||
self.llvm_options.opt_level
|
self.llvm_options.opt_level
|
||||||
).expect(format!("could not create target machine from properties {:?}", self.llvm_options.target).as_str());
|
).expect(format!("could not create target machine from properties {:?}", self.llvm_options.target).as_str());
|
||||||
let passes = format!("default<O{}>", self.llvm_options.opt_level as u32);
|
let passes = format!("default<O{}>", self.llvm_options.opt_level as u32);
|
||||||
|
|
||||||
let result = module.run_passes(passes.as_str(), &target_machine, pass_options);
|
let result = module.run_passes(passes.as_str(), &target_machine, pass_options);
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
panic!("Failed to run optimization for module `{}`: {}",
|
panic!("Failed to run optimization for module `{}`: {}",
|
||||||
|
|
|
@ -370,7 +370,8 @@ fn main() {
|
||||||
|
|
||||||
let pass_options = PassBuilderOptions::create();
|
let pass_options = PassBuilderOptions::create();
|
||||||
pass_options.set_merge_functions(true);
|
pass_options.set_merge_functions(true);
|
||||||
let result = main.run_passes("default<O3>", &target_machine, pass_options);
|
let passes = format!("default<O{}>", opt_level as u32);
|
||||||
|
let result = main.run_passes(passes.as_str(), &target_machine, pass_options);
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
panic!("Failed to run optimization for module `main`: {}", err.to_string());
|
panic!("Failed to run optimization for module `main`: {}", err.to_string());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue