]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove unused function from escape analysis
authorKeith Randall <khr@golang.org>
Wed, 21 May 2025 18:15:24 +0000 (11:15 -0700)
committerKeith Randall <khr@golang.org>
Wed, 21 May 2025 23:20:40 +0000 (16:20 -0700)
Change-Id: Ie6ff3d2dd62acfad6c1c7827973f1d9381923ca7
Reviewed-on: https://go-review.googlesource.com/c/go/+/675115
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
src/cmd/compile/internal/escape/graph.go

index 0bbf6bb9413571244768b1357630b3bbc525d133..d20809d4422bd32b5492ee3fe1c63e8d046d3816 100644 (file)
@@ -139,35 +139,6 @@ func (l *location) leakTo(sink *location, derefs int) {
        l.paramEsc.AddHeap(derefs)
 }
 
-// leakTo records that parameter l leaks to sink.
-func (b *batch) leakTo(l, sink *location, derefs int) {
-       if (logopt.Enabled() || base.Flag.LowerM >= 2) && !l.hasAttr(attrEscapes) {
-               if base.Flag.LowerM >= 2 {
-                       fmt.Printf("%s: parameter %v leaks to %s with derefs=%d:\n", base.FmtPos(l.n.Pos()), l.n, b.explainLoc(sink), derefs)
-               }
-               explanation := b.explainPath(sink, l)
-               if logopt.Enabled() {
-                       var e_curfn *ir.Func // TODO(mdempsky): Fix.
-                       logopt.LogOpt(l.n.Pos(), "leak", "escape", ir.FuncName(e_curfn),
-                               fmt.Sprintf("parameter %v leaks to %s with derefs=%d", l.n, b.explainLoc(sink), derefs), explanation)
-               }
-       }
-
-       // If sink is a result parameter that doesn't escape (#44614)
-       // and we can fit return bits into the escape analysis tag,
-       // then record as a result leak.
-       if !sink.hasAttr(attrEscapes) && sink.isName(ir.PPARAMOUT) && sink.curfn == l.curfn {
-               if ri := sink.resultIndex - 1; ri < numEscResults {
-                       // Leak to result parameter.
-                       l.paramEsc.AddResult(ri, derefs)
-                       return
-               }
-       }
-
-       // Otherwise, record as heap leak.
-       l.paramEsc.AddHeap(derefs)
-}
-
 func (l *location) isName(c ir.Class) bool {
        return l.n != nil && l.n.Op() == ir.ONAME && l.n.(*ir.Name).Class == c
 }