Skip to content

Commit 11f838d

Browse files
committed
Auto merge of #81978 - tmiasko:head-ctor, r=Mark-Simulacrum
Inline hot part of PatStack::head_ctor When building rustc with `-Codegen-units=1` this inline hint ensures that obtaining already initialized head constructor does not involve a function call overhead and reduces the instruction count in match-stress-enum-check full benchmark from 11.9G to 9.8G. It shouldn't have significant impact on the currently default configuration where it reflects existing inlining decisions.
2 parents a15f484 + a3659bb commit 11f838d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

compiler/rustc_mir_build/src/thir/pattern/usefulness.rs

+1
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,7 @@ impl<'p, 'tcx> PatStack<'p, 'tcx> {
439439
self.pats[0]
440440
}
441441

442+
#[inline]
442443
fn head_ctor<'a>(&'a self, cx: &MatchCheckCtxt<'p, 'tcx>) -> &'a Constructor<'tcx> {
443444
self.head_ctor.get_or_init(|| Constructor::from_pat(cx, self.head()))
444445
}

0 commit comments

Comments
 (0)