parent
4f840a683a
commit
97b30f0961
@ -11,6 +11,7 @@
|
||||
//! Inlining pass for MIR functions
|
||||
|
||||
use rustc::hir;
|
||||
use rustc::hir::TransFnAttrFlags;
|
||||
use rustc::hir::def_id::DefId;
|
||||
|
||||
use rustc_data_structures::bitvec::BitVector;
|
||||
@ -206,10 +207,9 @@ fn should_inline(&self,
|
||||
return false;
|
||||
}
|
||||
|
||||
let attrs = tcx.get_attrs(callsite.callee);
|
||||
let hint = tcx.trans_fn_attrs(callsite.callee).inline;
|
||||
let trans_fn_attrs = tcx.trans_fn_attrs(callsite.callee);
|
||||
|
||||
let hinted = match hint {
|
||||
let hinted = match trans_fn_attrs.inline {
|
||||
// Just treat inline(always) as a hint for now,
|
||||
// there are cases that prevent inlining that we
|
||||
// need to check for first.
|
||||
@ -239,7 +239,7 @@ fn should_inline(&self,
|
||||
};
|
||||
|
||||
// Significantly lower the threshold for inlining cold functions
|
||||
if attr::contains_name(&attrs[..], "cold") {
|
||||
if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) {
|
||||
threshold /= 5;
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ fn should_inline(&self,
|
||||
}
|
||||
}
|
||||
|
||||
if let attr::InlineAttr::Always = hint {
|
||||
if let attr::InlineAttr::Always = trans_fn_attrs.inline {
|
||||
debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost);
|
||||
true
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user