about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-08-05 23:11:49 +0000
committerbors <bors@rust-lang.org>2022-08-05 23:11:49 +0000
commit55f46419afd2e49acfc6be176ad4aeadaa5686d7 (patch)
treeb018496a0be96e9b8b596916bac464e9e0dea0ff /compiler
parentaffe0d3a00e92fa7885e3f5d2c5073fde432d154 (diff)
parent80c9012e422263a567d217c5699c4d88623afc32 (diff)
downloadrust-55f46419afd2e49acfc6be176ad4aeadaa5686d7.tar.gz
rust-55f46419afd2e49acfc6be176ad4aeadaa5686d7.zip
Auto merge of #100035 - workingjubilee:merge-functions, r=nikic
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.

Closes #98215.
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_codegen_ssa/src/back/write.rs7
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 1b5ad87107a..dbd55590e5c 100644
--- a/compiler/rustc_codegen_ssa/src/back/write.rs
+++ b/compiler/rustc_codegen_ssa/src/back/write.rs
@@ -256,8 +256,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,
+                    }
                 }
             },