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 away.
This commit is contained in:
Mark Rousskov 2021-10-03 12:43:43 -04:00
parent 2801a770ce
commit 1c2ad79f9d
2 changed files with 2 additions and 0 deletions

View File

@ -400,6 +400,7 @@ pub(crate) struct TyVidEqKey<'tcx> {
} }
impl<'tcx> From<ty::TyVid> for 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 { fn from(vid: ty::TyVid) -> Self {
TyVidEqKey { vid, phantom: PhantomData } TyVidEqKey { vid, phantom: PhantomData }
} }

View File

@ -437,6 +437,7 @@ impl EqUnifyValue for IntVarValue {}
impl UnifyKey for IntVid { impl UnifyKey for IntVid {
type Value = Option<IntVarValue>; type Value = Option<IntVarValue>;
#[inline] // make this function eligible for inlining - it is quite hot.
fn index(&self) -> u32 { fn index(&self) -> u32 {
self.index self.index
} }