From 3fb86fb8645ceb6163d1a9f573c2b4eec2a310f9 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Fri, 15 Sep 2023 12:13:09 -0400 Subject: cmd/compile: add pgohash for debugging/bisecting PGO optimizations When a PGO build fails or produces incorrect program, it is often unclear what the problem is. Add pgo hash so we can bisect to individual optimization decisions, which often helps debugging. Related to #58153. Change-Id: I651ffd9c53bad60f2f28c8ec2a90a3f532982712 Reviewed-on: https://go-review.googlesource.com/c/go/+/528400 LUCI-TryBot-Result: Go LUCI Reviewed-by: Michael Pratt --- src/cmd/compile/internal/devirtualize/pgo.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/cmd/compile/internal/devirtualize') diff --git a/src/cmd/compile/internal/devirtualize/pgo.go b/src/cmd/compile/internal/devirtualize/pgo.go index b51028701e..a04ff16d60 100644 --- a/src/cmd/compile/internal/devirtualize/pgo.go +++ b/src/cmd/compile/internal/devirtualize/pgo.go @@ -155,6 +155,11 @@ func ProfileGuided(fn *ir.Func, p *pgo.Profile) { return n } + if !base.PGOHash.MatchPosWithInfo(n.Pos(), "devirt", nil) { + // De-selected by PGO Hash. + return n + } + if stat != nil { stat.Devirtualized = ir.LinkFuncName(callee) stat.DevirtualizedWeight = weight -- cgit v1.3-5-g9baa