Enable function merging when opt is for size
It is, of course, natural to want to merge aliasing functions when optimizing for code size, since that can eliminate several bytes. And an exhaustive match helps make the code less brittle.
This commit is contained in:
parent
b4151a41a0
commit
80c9012e42
@ -255,8 +255,11 @@ macro_rules! if_regular {
|
||||
{
|
||||
MergeFunctions::Disabled => false,
|
||||
MergeFunctions::Trampolines | MergeFunctions::Aliases => {
|
||||
sess.opts.optimize == config::OptLevel::Default
|
||||
|| sess.opts.optimize == config::OptLevel::Aggressive
|
||||
use config::OptLevel::*;
|
||||
match sess.opts.optimize {
|
||||
Aggressive | Default | SizeMin | Size => true,
|
||||
Less | No => false,
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
@ -1,7 +1,9 @@
|
||||
// compile-flags: -O
|
||||
// revisions: O Os
|
||||
//[Os] compile-flags: -Copt-level=s
|
||||
//[O] compile-flags: -O
|
||||
#![crate_type = "lib"]
|
||||
|
||||
// CHECK: @func2 = {{.*}}alias{{.*}}@func1
|
||||
// CHECK: @func{{2|1}} = {{.*}}alias{{.*}}@func{{1|2}}
|
||||
|
||||
#[no_mangle]
|
||||
pub fn func1(c: char) -> bool {
|
||||
|
Loading…
Reference in New Issue
Block a user