diff options
| author | Jubilee Young <workingjubilee@gmail.com> | 2022-08-01 14:04:14 -0700 |
|---|---|---|
| committer | Jubilee Young <workingjubilee@gmail.com> | 2022-08-05 14:59:32 -0700 |
| commit | 80c9012e422263a567d217c5699c4d88623afc32 (patch) | |
| tree | 7ed4b60720241c16e44e8bcbcc29987808fb6775 /compiler/rustc_codegen_ssa/src/back | |
| parent | b4151a41a0b275dee59ffbbc115e7bfc5be8a8c3 (diff) | |
| download | rust-80c9012e422263a567d217c5699c4d88623afc32.tar.gz rust-80c9012e422263a567d217c5699c4d88623afc32.zip | |
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.
Diffstat (limited to 'compiler/rustc_codegen_ssa/src/back')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/write.rs | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/write.rs b/compiler/rustc_codegen_ssa/src/back/write.rs index ea60f6055f3..9657e2af3e6 100644 --- a/compiler/rustc_codegen_ssa/src/back/write.rs +++ b/compiler/rustc_codegen_ssa/src/back/write.rs @@ -255,8 +255,11 @@ impl ModuleConfig { { 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, + } } }, |
