Skip to content

Commit c272284

Browse files
Added two missing changes during the porting
1 parent 7b1c59c commit c272284

File tree

1 file changed

+10
-4
lines changed
  • src/cmd/compile/internal/inline

1 file changed

+10
-4
lines changed

src/cmd/compile/internal/inline/inl.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,14 @@ func CanInline(fn *ir.Func) {
267267
budget: inlineMaxBudget,
268268
extraCallCost: cc,
269269
}
270+
savefn := ir.CurFunc
271+
ir.CurFunc = fn
270272
if visitor.tooHairy(fn) {
271273
reason = visitor.reason
274+
ir.CurFunc = savefn
272275
return
273276
}
277+
ir.CurFunc = savefn
274278

275279
n.Func.Inl = &ir.Inline{
276280
Cost: inlineMaxBudget - visitor.budget,
@@ -581,10 +585,12 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
581585

582586
v.budget--
583587

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+
}
588594
}
589595

590596
return ir.DoChildren(n, v.do)

0 commit comments

Comments
 (0)