Consume optimization fuel from the MIR inliner
This makes it easier to debug mis-optimizations that occur during inlining. Thanks to @nikomatsakis for the suggestion!
This commit is contained in:
parent
ddd4b194a0
commit
e72afa9573
1 changed files with 13 additions and 1 deletions
|
|
@ -137,7 +137,7 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
|||
|
||||
let callee_mir = match self.tcx.try_optimized_mir(callsite.location.span,
|
||||
callsite.callee) {
|
||||
Ok(callee_mir) if self.should_inline(callsite, callee_mir) => {
|
||||
Ok(callee_mir) if self.consider_optimizing(callsite, callee_mir) => {
|
||||
self.tcx.subst_and_normalize_erasing_regions(
|
||||
&callsite.substs,
|
||||
param_env,
|
||||
|
|
@ -198,6 +198,18 @@ impl<'a, 'tcx> Inliner<'a, 'tcx> {
|
|||
}
|
||||
}
|
||||
|
||||
fn consider_optimizing(&self,
|
||||
callsite: CallSite<'tcx>,
|
||||
callee_mir: &Mir<'tcx>)
|
||||
-> bool
|
||||
{
|
||||
debug!("consider_optimizing({:?})", callsite);
|
||||
self.should_inline(callsite, callee_mir)
|
||||
&& self.tcx.consider_optimizing(|| format!("Inline {:?} into {:?}",
|
||||
callee_mir.span,
|
||||
callsite))
|
||||
}
|
||||
|
||||
fn should_inline(&self,
|
||||
callsite: CallSite<'tcx>,
|
||||
callee_mir: &Mir<'tcx>)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue