diff options
| author | Ben Kimock <kimockb@gmail.com> | 2023-06-04 20:21:00 -0400 |
|---|---|---|
| committer | Ben Kimock <kimockb@gmail.com> | 2023-06-16 11:36:02 -0400 |
| commit | c153f3a356b0e7917c91d3a804b93fadffb778b0 (patch) | |
| tree | 952578ab7bf02fc596dafa32c1d64f83bebd6708 /compiler/rustc_mir_transform/src | |
| parent | 99b334696fffe8c08d2e6a978862849d5a89f875 (diff) | |
| download | rust-c153f3a356b0e7917c91d3a804b93fadffb778b0.tar.gz rust-c153f3a356b0e7917c91d3a804b93fadffb778b0.zip | |
Ignore the always part of #[inline(always)] in MIR inlining
Diffstat (limited to 'compiler/rustc_mir_transform/src')
| -rw-r--r-- | compiler/rustc_mir_transform/src/inline.rs | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/compiler/rustc_mir_transform/src/inline.rs b/compiler/rustc_mir_transform/src/inline.rs index 5487b5987e0..b28fed7159f 100644 --- a/compiler/rustc_mir_transform/src/inline.rs +++ b/compiler/rustc_mir_transform/src/inline.rs @@ -479,11 +479,12 @@ impl<'tcx> Inliner<'tcx> { // Abort if type validation found anything fishy. checker.validation?; + // N.B. We still apply our cost threshold to #[inline(always)] functions. + // That attribute is often applied to very large functions that exceed LLVM's (very + // generous) inlining threshold. Such functions are very poor MIR inlining candidates. + // Always inlining #[inline(always)] functions in MIR, on net, slows down the compiler. let cost = checker.cost; - if let InlineAttr::Always = callee_attrs.inline { - debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost); - Ok(()) - } else if cost <= threshold { + if cost <= threshold { debug!("INLINING {:?} [cost={} <= threshold={}]", callsite, cost, threshold); Ok(()) } else { |
