about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-03-26 11:57:44 +0000
committerbors <bors@rust-lang.org>2021-03-26 11:57:44 +0000
commite423058751a2b098d3e469a8e6df1b7a8bbd67b6 (patch)
treea70b6b5716cd7627d14a1cbb6671047d702f1862 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent4137088d9da94f693b287f35e2b17782c0b1a283 (diff)
parent1aee8083bec509ad290650209d0623db574609d3 (diff)
downloadrust-e423058751a2b098d3e469a8e6df1b7a8bbd67b6.tar.gz
rust-e423058751a2b098d3e469a8e6df1b7a8bbd67b6.zip
Auto merge of #82980 - tmiasko:import-cold-multiplier, r=michaelwoerister
Import small cold functions

The Rust code is often written under an assumption that for generic
methods inline attribute is mostly unnecessary, since for optimized
builds using ThinLTO, a method will be code generated in at least one
CGU and available for import.

For example, deref implementations for Box, Vec, MutexGuard, and
MutexGuard are not currently marked as inline, neither is identity
implementation of From trait.

In PGO builds, when functions are determined to be cold, the default
multiplier of zero will stop the import, no matter how trivial the
implementation.

Increase slightly the default multiplier from 0 to 0.1.

r? `@ghost`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm_util.rs')
-rw-r--r--compiler/rustc_codegen_llvm/src/llvm_util.rs3
1 files changed, 3 insertions, 0 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm_util.rs b/compiler/rustc_codegen_llvm/src/llvm_util.rs
index c7dff41955e..e80de2bc902 100644
--- a/compiler/rustc_codegen_llvm/src/llvm_util.rs
+++ b/compiler/rustc_codegen_llvm/src/llvm_util.rs
@@ -98,6 +98,9 @@ unsafe fn configure_llvm(sess: &Session) {
         // during inlining. Unfortunately these may block other optimizations.
         add("-preserve-alignment-assumptions-during-inlining=false", false);
 
+        // Use non-zero `import-instr-limit` multiplier for cold callsites.
+        add("-import-cold-multiplier=0.1", false);
+
         for arg in sess_args {
             add(&(*arg), true);
         }