about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2021-10-07 06:23:23 +0000
committerbors <bors@rust-lang.org>2021-10-07 06:23:23 +0000
commitca8078d7b2e40c24a39e5fe2a910afef4c91ebfc (patch)
tree9cc6117c01bcd8dfa90105c01335a5969ef6a727
parentd3e6770efbd76c4ad1e17468895b538a2efec4bd (diff)
parent1c2ad79f9d789b0d449a1bc4dfe7d7ddc2ed4109 (diff)
downloadrust-ca8078d7b2e40c24a39e5fe2a910afef4c91ebfc.tar.gz
rust-ca8078d7b2e40c24a39e5fe2a910afef4c91ebfc.zip
Auto merge of #89495 - Mark-Simulacrum:add-inlines, r=michaelwoerister
Add two inline annotations for hot functions

These two functions are essentially no-ops (and compile to just a load and
return), but show up in process_obligations profiles with a high call count --
so worthwhile to try and inline them. This is not normally possible as they're
non-generic, so they don't get offered for inlining by our current algorithm.
-rw-r--r--compiler/rustc_infer/src/infer/type_variable.rs1
-rw-r--r--compiler/rustc_type_ir/src/lib.rs1
2 files changed, 2 insertions, 0 deletions
diff --git a/compiler/rustc_infer/src/infer/type_variable.rs b/compiler/rustc_infer/src/infer/type_variable.rs
index 0e832685310..82970f214fa 100644
--- a/compiler/rustc_infer/src/infer/type_variable.rs
+++ b/compiler/rustc_infer/src/infer/type_variable.rs
@@ -400,6 +400,7 @@ pub(crate) struct TyVidEqKey<'tcx> {
 }
 
 impl<'tcx> From<ty::TyVid> for TyVidEqKey<'tcx> {
+    #[inline] // make this function eligible for inlining - it is quite hot.
     fn from(vid: ty::TyVid) -> Self {
         TyVidEqKey { vid, phantom: PhantomData }
     }
diff --git a/compiler/rustc_type_ir/src/lib.rs b/compiler/rustc_type_ir/src/lib.rs
index d9ce169efc1..91dbbec782f 100644
--- a/compiler/rustc_type_ir/src/lib.rs
+++ b/compiler/rustc_type_ir/src/lib.rs
@@ -437,6 +437,7 @@ impl EqUnifyValue for IntVarValue {}
 
 impl UnifyKey for IntVid {
     type Value = Option<IntVarValue>;
+    #[inline] // make this function eligible for inlining - it is quite hot.
     fn index(&self) -> u32 {
         self.index
     }