1
0
mirror of https://github.com/golang/go synced 2024-11-17 06:04:47 -07:00

[dev.typeparams] cmd/compile: add -d=unifiedquirks for quirks mode

Originally, overloading -d=inlfuncswithclosures=0 to enable quirks
mode was convenient because toolstash -cmp doesn't provide a way to
pass different gcflags to the installed vs stashed toolchains. Prior
to unified IR being merged, the stashed toolchain wouldn't know about
or accept any unified-specific flags.

However, this concern is no longer applicable since unified IR has
been merged, and the TestUnifiedCompare test can easily specify
different flag sets for the baseline and experiment build configs.

This CL adds a new -d=unifiedquirks flag to enable quirks mode, so
that it's possible to test unified IR with -d=inlfuncswithclosures=0
without also affecting a bunch of other compilation details.

Change-Id: Id1932f332822622aa8617278e82ec6d1a53b1b46
Reviewed-on: https://go-review.googlesource.com/c/go/+/329733
Trust: Matthew Dempsky <mdempsky@google.com>
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Matthew Dempsky 2021-06-21 20:03:58 -07:00
parent d626ba27bb
commit 859d903b06
3 changed files with 3 additions and 5 deletions

View File

@ -48,6 +48,7 @@ type DebugFlags struct {
TypeAssert int `help:"print information about type assertion inlining"`
TypecheckInl int `help:"eager typechecking of inline function bodies"`
Unified int `help:"enable unified IR construction"`
UnifiedQuirks int `help:"enable unified IR construction's quirks mode"`
WB int `help:"print information about write barriers"`
ABIWrap int `help:"print information about ABI wrapper generation"`

View File

@ -23,10 +23,7 @@ import (
// quirksMode controls whether behavior specific to satisfying
// toolstash -cmp is used.
func quirksMode() bool {
// Currently, unified IR doesn't try to be compatible with
// -d=inlfuncswithclosures=1, so we overload this as a flag for
// enabling quirks mode.
return base.Debug.InlFuncsWithClosures == 0
return base.Debug.UnifiedQuirks != 0
}
// posBasesOf returns all of the position bases in the source files,

View File

@ -59,7 +59,7 @@ func TestUnifiedCompare(t *testing.T) {
}
pkgs1 := loadPackages(t, goos, goarch, "-d=unified=0 -d=inlfuncswithclosures=0")
pkgs2 := loadPackages(t, goos, goarch, "-d=unified=1 -d=inlfuncswithclosures=0")
pkgs2 := loadPackages(t, goos, goarch, "-d=unified=1 -d=inlfuncswithclosures=0 -d=unifiedquirks=1")
if len(pkgs1) != len(pkgs2) {
t.Fatalf("length mismatch: %v != %v", len(pkgs1), len(pkgs2))