mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-27 22:09:09 +00:00
Merge branch 'trunk' into gui-example
This commit is contained in:
commit
a49b66e379
10 changed files with 142 additions and 46 deletions
|
@ -657,35 +657,43 @@ pub fn construct_optimization_passes<'a>(
|
|||
OptLevel::Development | OptLevel::Normal => {
|
||||
pmb.set_optimization_level(OptimizationLevel::None);
|
||||
}
|
||||
OptLevel::Size => {
|
||||
pmb.set_optimization_level(OptimizationLevel::Default);
|
||||
// TODO: For some usecase, like embedded, it is useful to expose this and tune it.
|
||||
pmb.set_inliner_with_threshold(50);
|
||||
}
|
||||
OptLevel::Optimize => {
|
||||
pmb.set_optimization_level(OptimizationLevel::Aggressive);
|
||||
// this threshold seems to do what we want
|
||||
pmb.set_inliner_with_threshold(275);
|
||||
|
||||
// TODO figure out which of these actually help
|
||||
|
||||
// function passes
|
||||
|
||||
fpm.add_cfg_simplification_pass();
|
||||
mpm.add_cfg_simplification_pass();
|
||||
|
||||
fpm.add_jump_threading_pass();
|
||||
mpm.add_jump_threading_pass();
|
||||
|
||||
fpm.add_memcpy_optimize_pass(); // this one is very important
|
||||
|
||||
fpm.add_licm_pass();
|
||||
|
||||
// turn invoke into call
|
||||
mpm.add_prune_eh_pass();
|
||||
|
||||
// remove unused global values (often the `_wrapper` can be removed)
|
||||
mpm.add_global_dce_pass();
|
||||
|
||||
mpm.add_function_inlining_pass();
|
||||
}
|
||||
}
|
||||
|
||||
// Add optimization passes for Size and Optimize.
|
||||
if matches!(opt_level, OptLevel::Size | OptLevel::Optimize) {
|
||||
// TODO figure out which of these actually help
|
||||
|
||||
// function passes
|
||||
|
||||
fpm.add_cfg_simplification_pass();
|
||||
mpm.add_cfg_simplification_pass();
|
||||
|
||||
fpm.add_jump_threading_pass();
|
||||
mpm.add_jump_threading_pass();
|
||||
|
||||
fpm.add_memcpy_optimize_pass(); // this one is very important
|
||||
|
||||
fpm.add_licm_pass();
|
||||
|
||||
// turn invoke into call
|
||||
mpm.add_prune_eh_pass();
|
||||
|
||||
// remove unused global values (often the `_wrapper` can be removed)
|
||||
mpm.add_global_dce_pass();
|
||||
|
||||
mpm.add_function_inlining_pass();
|
||||
}
|
||||
|
||||
pmb.populate_module_pass_manager(&mpm);
|
||||
pmb.populate_function_pass_manager(&fpm);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue