Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit dd153da

Browse files
committed
Auto merge of rust-lang#137567 - FractalFir:inline_hints, r=<try>
[Perf experiment] Inline hints on some small, hot functions During some local profiling, I identified a few tiny hot functions which did not get inlined. From some local perf runs, it looks like adding inline hints to them is beneficial. ![image](https://github.com/user-attachments/assets/22e58ab0-d6a4-46fe-9cd2-dee23d2027a5) I have checked this change both with and without LTO, and I still see a perf difference between the version with and without inline hints. So, this *may* be a good change. However, since I can't run the compiler PGO setup locally, I'll need a perf run to see if this improvement will be seen in the CI build of `rustc`. There is a chance this optimization is already done by PGO(in which case this PR is less useful), but I still want to see if this can have any real effect.
2 parents 617aad8 + aa1d580 commit dd153da

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/rustc_middle/src/ty/context.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2427,6 +2427,7 @@ impl<'tcx, T: 'tcx + ?Sized> IntoPointer for InternedInSet<'tcx, T> {
24272427

24282428
#[allow(rustc::usage_of_ty_tykind)]
24292429
impl<'tcx, T> Borrow<T> for InternedInSet<'tcx, WithCachedTypeInfo<T>> {
2430+
#[inline]
24302431
fn borrow(&self) -> &T {
24312432
&self.0.internee
24322433
}

compiler/rustc_middle/src/ty/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,10 +440,11 @@ impl<'tcx> rustc_type_ir::inherent::IntoKind for Ty<'tcx> {
440440
}
441441

442442
impl<'tcx> rustc_type_ir::visit::Flags for Ty<'tcx> {
443+
#[inline]
443444
fn flags(&self) -> TypeFlags {
444445
self.0.flags
445446
}
446-
447+
#[inline]
447448
fn outer_exclusive_binder(&self) -> DebruijnIndex {
448449
self.0.outer_exclusive_binder
449450
}

0 commit comments

Comments
 (0)