File tree Expand file tree Collapse file tree 1 file changed +4
-5
lines changed
src/cmd/compile/internal/inline Expand file tree Collapse file tree 1 file changed +4
-5
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ func InlinePackage() {
73
73
})
74
74
}
75
75
76
- // Caninl determines whether fn is inlineable.
76
+ // CanInline determines whether fn is inlineable.
77
77
// If so, CanInline saves fn->nbody in fn->inl and substitutes it with a copy.
78
78
// fn and ->nbody will already have been typechecked.
79
79
func CanInline (fn * ir.Func ) {
@@ -169,7 +169,6 @@ func CanInline(fn *ir.Func) {
169
169
visitor := hairyVisitor {
170
170
budget : inlineMaxBudget ,
171
171
extraCallCost : cc ,
172
- usedLocals : make (map [* ir.Name ]bool ),
173
172
}
174
173
if visitor .tooHairy (fn ) {
175
174
reason = visitor .reason
@@ -254,7 +253,7 @@ type hairyVisitor struct {
254
253
budget int32
255
254
reason string
256
255
extraCallCost int32
257
- usedLocals map [ * ir.Name ] bool
256
+ usedLocals ir.NameSet
258
257
do func (ir.Node ) bool
259
258
}
260
259
@@ -410,7 +409,7 @@ func (v *hairyVisitor) doNode(n ir.Node) bool {
410
409
case ir .ONAME :
411
410
n := n .(* ir.Name )
412
411
if n .Class == ir .PAUTO {
413
- v .usedLocals [ n ] = true
412
+ v .usedLocals . Add ( n )
414
413
}
415
414
416
415
case ir .OBLOCK :
@@ -1383,7 +1382,7 @@ func pruneUnusedAutos(ll []*ir.Name, vis *hairyVisitor) []*ir.Name {
1383
1382
s := make ([]* ir.Name , 0 , len (ll ))
1384
1383
for _ , n := range ll {
1385
1384
if n .Class == ir .PAUTO {
1386
- if _ , found := vis .usedLocals [ n ]; ! found {
1385
+ if ! vis .usedLocals . Has ( n ) {
1387
1386
continue
1388
1387
}
1389
1388
}
You can’t perform that action at this time.
0 commit comments