Skip to content

Commit

Permalink
Avoid triggering a pathological case in the LLVM inliner
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dotdash committed Sep 11, 2015
1 parent e3fd444 commit 9104a90
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_platform_intrinsics/aarch64.rs
Expand Up @@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
use IntrinsicDef::Named;
use rustc::middle::ty;

#[inline(never)]
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
if !name.starts_with("aarch64_v") { return None }
Some(match &name["aarch64_v".len()..] {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_platform_intrinsics/arm.rs
Expand Up @@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, agg, p};
use IntrinsicDef::Named;
use rustc::middle::ty;

#[inline(never)]
pub fn find<'tcx>(_tcx: &ty::ctxt<'tcx>, name: &str) -> Option<Intrinsic> {
if !name.starts_with("arm_v") { return None }
Some(match &name["arm_v".len()..] {
Expand Down
1 change: 1 addition & 0 deletions src/librustc_platform_intrinsics/x86.rs
Expand Up @@ -17,6 +17,7 @@ use {Intrinsic, i, i_, u, u_, f, v, v_, agg, p, void};
use IntrinsicDef::Named;
use rustc::middle::ty;

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

0 comments on commit 9104a90

Please sign in to comment.