提交 97b30f09 编写于 作者: W Wesley Wiser

Replace attr::contains_name(..., "cold")

Part of #47320
上级 4f840a68
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册