From e46d586eddfdd2186d77a5e996bbd6415cfcf2f5 Mon Sep 17 00:00:00 2001 From: thepudds Date: Sat, 28 Jun 2025 16:53:37 -0400 Subject: cmd/compile/internal/escape: add debug hash for literal allocation optimizations Several CLs earlier in this stack added optimizations to reduce user allocations by recognizing and taking advantage of literals, including CL 649555, CL 649079, and CL 649035. This CL adds debug hashing of those changes, which enables use of the bisect tool, such as 'bisect -compile=literalalloc go test -run=Foo'. This also allows these optimizations to be manually disabled via '-gcflags=all=-d=literalallochash=n'. Updates #71359 Change-Id: I854f7742a6efa5b17d914932d61a32b2297f0c88 Reviewed-on: https://go-review.googlesource.com/c/go/+/675415 LUCI-TryBot-Result: Go LUCI Reviewed-by: David Chase Reviewed-by: Cherry Mui --- src/cmd/compile/internal/base/debug.go | 1 + 1 file changed, 1 insertion(+) (limited to 'src/cmd/compile/internal/base/debug.go') diff --git a/src/cmd/compile/internal/base/debug.go b/src/cmd/compile/internal/base/debug.go index 10393e773c..85873dcc40 100644 --- a/src/cmd/compile/internal/base/debug.go +++ b/src/cmd/compile/internal/base/debug.go @@ -40,6 +40,7 @@ type DebugFlags struct { InlFuncsWithClosures int `help:"allow functions with closures to be inlined" concurrent:"ok"` InlStaticInit int `help:"allow static initialization of inlined calls" concurrent:"ok"` Libfuzzer int `help:"enable coverage instrumentation for libfuzzer"` + LiteralAllocHash string `help:"hash value for use in debugging literal allocation optimizations" concurrent:"ok"` LoopVar int `help:"shared (0, default), 1 (private loop variables), 2, private + log"` LoopVarHash string `help:"for debugging changes in loop behavior. Overrides experiment and loopvar flag."` LocationLists int `help:"print information about DWARF location list creation"` -- cgit v1.3