cmd/compile: changed variable name due to shadowing of package name min

Change-Id: I52e5de04d137238d6f6779edcc662f5c7433c61e
Reviewed-on: https://go-review.googlesource.com/c/go/+/660195
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
This commit is contained in:
Sergey Slukin 2025-03-22 21:15:18 +03:00 committed by Keith Randall
parent 144d4e5d5f
commit 116b82354c

View File

@ -22,7 +22,7 @@ package ir
// Second, each function becomes two virtual nodes in the graph, // Second, each function becomes two virtual nodes in the graph,
// with numbers n and n+1. We record the function's node number as n // with numbers n and n+1. We record the function's node number as n
// but search from node n+1. If the search tells us that the component // but search from node n+1. If the search tells us that the component
// number (min) is n+1, we know that this is a trivial component: one function // number (minVisitGen) is n+1, we know that this is a trivial component: one function
// plus its closures. If the search tells us that the component number is // plus its closures. If the search tells us that the component number is
// n, then there was a path from node n+1 back to node n, meaning that // n, then there was a path from node n+1 back to node n, meaning that
// the function set is mutually recursive. The escape analysis can be // the function set is mutually recursive. The escape analysis can be
@ -70,13 +70,13 @@ func (v *bottomUpVisitor) visit(n *Func) uint32 {
id := v.visitgen id := v.visitgen
v.nodeID[n] = id v.nodeID[n] = id
v.visitgen++ v.visitgen++
min := v.visitgen minVisitGen := v.visitgen
v.stack = append(v.stack, n) v.stack = append(v.stack, n)
do := func(defn Node) { do := func(defn Node) {
if defn != nil { if defn != nil {
if m := v.visit(defn.(*Func)); m < min { if m := v.visit(defn.(*Func)); m < minVisitGen {
min = m minVisitGen = m
} }
} }
} }
@ -97,13 +97,13 @@ func (v *bottomUpVisitor) visit(n *Func) uint32 {
} }
}) })
if (min == id || min == id+1) && !n.IsClosure() { if (minVisitGen == id || minVisitGen == id+1) && !n.IsClosure() {
// This node is the root of a strongly connected component. // This node is the root of a strongly connected component.
// The original min was id+1. If the bottomUpVisitor found its way // The original minVisitGen was id+1. If the bottomUpVisitor found its way
// back to id, then this block is a set of mutually recursive functions. // back to id, then this block is a set of mutually recursive functions.
// Otherwise, it's just a lone function that does not recurse. // Otherwise, it's just a lone function that does not recurse.
recursive := min == id recursive := minVisitGen == id
// Remove connected component from stack and mark v.nodeID so that future // Remove connected component from stack and mark v.nodeID so that future
// visits return a large number, which will not affect the caller's min. // visits return a large number, which will not affect the caller's min.
@ -121,5 +121,5 @@ func (v *bottomUpVisitor) visit(n *Func) uint32 {
v.analyze(block, recursive) v.analyze(block, recursive)
} }
return min return minVisitGen
} }