aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/devirtualize
diff options
context:
space:
mode:
authorCherry Mui <cherryyz@google.com>2023-09-15 12:13:09 -0400
committerCherry Mui <cherryyz@google.com>2023-09-19 15:42:58 +0000
commit3fb86fb8645ceb6163d1a9f573c2b4eec2a310f9 (patch)
tree92c0f9ea7adc8d2a042971fabdb56396f050a9bc /src/cmd/compile/internal/devirtualize
parenteca5a97340e6b475268a522012f30e8e25bb8b8f (diff)
downloadgo-3fb86fb8645ceb6163d1a9f573c2b4eec2a310f9.tar.xz
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 <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Michael Pratt <mpratt@google.com>
Diffstat (limited to 'src/cmd/compile/internal/devirtualize')
-rw-r--r--src/cmd/compile/internal/devirtualize/pgo.go5
1 files changed, 5 insertions, 0 deletions
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