File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
src/cmd/compile/internal/inline Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -267,10 +267,14 @@ func CanInline(fn *ir.Func) {
267
267
budget : inlineMaxBudget ,
268
268
extraCallCost : cc ,
269
269
}
270
+ savefn := ir .CurFunc
271
+ ir .CurFunc = fn
270
272
if visitor .tooHairy (fn ) {
271
273
reason = visitor .reason
274
+ ir .CurFunc = savefn
272
275
return
273
276
}
277
+ ir .CurFunc = savefn
274
278
275
279
n .Func .Inl = & ir.Inline {
276
280
Cost : inlineMaxBudget - visitor .budget ,
@@ -581,10 +585,12 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
581
585
582
586
v .budget --
583
587
584
- // When debugging, don't stop early, to get full cost of inlining this function
585
- if v .budget < 0 && base .Flag .LowerM < 2 && ! logopt .Enabled () {
586
- v .reason = "too expensive"
587
- return true
588
+ if pgo .WeightedCG == nil {
589
+ // When debugging, don't stop early, to get full cost of inlining this function
590
+ if v .budget < 0 && base .Flag .LowerM < 2 && ! logopt .Enabled () {
591
+ v .reason = "too expensive"
592
+ return true
593
+ }
588
594
}
589
595
590
596
return ir .DoChildren (n , v .do )
You can’t perform that action at this time.
0 commit comments