Skip to content

Commit

Permalink
Auto merge of rust-lang#82980 - tmiasko:import-cold-multiplier, r=mic…
Browse files Browse the repository at this point in the history
…haelwoerister

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`
  • Loading branch information
bors committed Mar 26, 2021
2 parents 4137088 + 1aee808 commit e423058
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e423058

Please sign in to comment.