|
11 | 11 | //! Inlining pass for MIR functions
|
12 | 12 |
|
13 | 13 | use rustc::hir;
|
| 14 | +use rustc::hir::TransFnAttrFlags; |
14 | 15 | use rustc::hir::def_id::DefId;
|
15 | 16 |
|
16 | 17 | use rustc_data_structures::bitvec::BitVector;
|
@@ -206,10 +207,9 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
206 | 207 | return false;
|
207 | 208 | }
|
208 | 209 |
|
209 |
| - let attrs = tcx.get_attrs(callsite.callee); |
210 |
| - let hint = tcx.trans_fn_attrs(callsite.callee).inline; |
| 210 | + let trans_fn_attrs = tcx.trans_fn_attrs(callsite.callee); |
211 | 211 |
|
212 |
| - let hinted = match hint { |
| 212 | + let hinted = match trans_fn_attrs.inline { |
213 | 213 | // Just treat inline(always) as a hint for now,
|
214 | 214 | // there are cases that prevent inlining that we
|
215 | 215 | // need to check for first.
|
@@ -239,7 +239,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
239 | 239 | };
|
240 | 240 |
|
241 | 241 | // Significantly lower the threshold for inlining cold functions
|
242 |
| - if attr::contains_name(&attrs[..], "cold") { |
| 242 | + if trans_fn_attrs.flags.contains(TransFnAttrFlags::COLD) { |
243 | 243 | threshold /= 5;
|
244 | 244 | }
|
245 | 245 |
|
@@ -344,7 +344,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
344 | 344 | }
|
345 | 345 | }
|
346 | 346 |
|
347 |
| - if let attr::InlineAttr::Always = hint { |
| 347 | + if let attr::InlineAttr::Always = trans_fn_attrs.inline { |
348 | 348 | debug!("INLINING {:?} because inline(always) [cost={}]", callsite, cost);
|
349 | 349 | true
|
350 | 350 | } else {
|
|
0 commit comments