]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/pgo: remove ConvertLine2Int
authorMichael Pratt <mpratt@google.com>
Fri, 28 Oct 2022 17:52:43 +0000 (13:52 -0400)
committerGopher Robot <gobot@golang.org>
Mon, 31 Oct 2022 21:00:25 +0000 (21:00 +0000)
commitec0b540293a9a0e2c376721b48a208e1fbef5e29
tree44d9cb7e276a85eaf561d60d48a5f5464379ea54
parente8ec68edfac4f50f57dd7faf039bb5c0f8eaba88
cmd/compile/internal/pgo: remove ConvertLine2Int

Parts of package pgo fetch the line number of a node by parsing the
number out of the string returned from ir.Line().

This is indirect and inefficient, so it should be replaced with a more
direct lookup. It is also potentially buggy: ir.Line uses
ctxt.OutermostPos, i.e., the line number where an inlined node in
inlined. We want ctxt.InnermostPos, because that is the line number used
in pprof profiles that we are matching against (See comments on
OutermostPos and InnermostPos).

I'm not sure whether this was an active, as we use ir.Line before and
during inlining. I think we could see CALL nodes with OutermostPos !=
InnermostPos during midstack inlining, but I am not sure. Regardless,
explicitly using the desired position is clearer.

For #55022.

Change-Id: Ic640761c9e1d01cacbf91f3aaeaf284ad7e38dbd
Reviewed-on: https://go-review.googlesource.com/c/go/+/446302
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Michael Pratt <mpratt@google.com>
Auto-Submit: Michael Pratt <mpratt@google.com>
src/cmd/compile/internal/inline/inl.go
src/cmd/compile/internal/pgo/irgraph.go