Skip to content

Commit 9104a90

Browse files
committed
Avoid triggering a pathological case in the LLVM inliner
When the inliner has to decided if it wants to inline a function A into an internal function B, it first checks whether it would be more profitable to inline B into its callees instead. This means that it has to analyze B, which involves checking the assumption cache. Building the assumption cache requires scanning the whole function, and because inlining currently clears the assumption cache, this scan happens again and again, getting even slower as the function grows from inlining. As inlining the huge find functions isn't really useful anyway, we can mark them as noinline, which skips the cost analysis and reduces compile times by as much as 70%. cc #28273
1 parent e3fd444 commit 9104a90

File tree

3 files changed

+3
-0
lines changed

3 files changed

+3
-0
lines changed

src/librustc_platform_intrinsics/aarch64.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
1717
use IntrinsicDef::Named;
1818
use rustc::middle::ty;
1919

20+
#[inline(never)]
2021
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
2122
if !name.starts_with("aarch64_v") { return None }
2223
Some(match &name["aarch64_v".len()..] {

src/librustc_platform_intrinsics/arm.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, agg, p};
1717
use IntrinsicDef::Named;
1818
use rustc::middle::ty;
1919

20+
#[inline(never)]
2021
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
2122
if !name.starts_with("arm_v") { return None }
2223
Some(match &name["arm_v".len()..] {

src/librustc_platform_intrinsics/x86.rs

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
1717
use IntrinsicDef::Named;
1818
use rustc::middle::ty;
1919

20+
#[inline(never)]
2021
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
2122
if !name.starts_with("x86_mm") { return None }
2223
Some(match &name["x86_mm".len()..] {

0 commit comments

Comments
 (0)