about summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/llvm_util.rs
diff options
context:
space:
mode:
authorTomasz Miąsko <tomasz.miasko@gmail.com>2021-03-11 00:00:00 +0000
committerTomasz Miąsko <tomasz.miasko@gmail.com>2021-03-11 00:00:00 +0000
commit1aee8083bec509ad290650209d0623db574609d3 (patch)
tree55e337e131503609f6c9dcc7274e887a37a5fdc0 /compiler/rustc_codegen_llvm/src/llvm_util.rs
parent04fce73196638cbb203e2b0dd2a16230ff6e265b (diff)
downloadrust-1aee8083bec509ad290650209d0623db574609d3.tar.gz
rust-1aee8083bec509ad290650209d0623db574609d3.zip
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 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, even for completely trivial
functions.

Increase slightly the default multiplier from 0 to 0.1 to import them
regardless.
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 544ef38c12c..93bad74cd21 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);
         }