From a21bb839cb86a94166f5248eca396bdaa0815522 Mon Sep 17 00:00:00 2001 From: Cherry Mui Date: Tue, 6 Jun 2023 16:53:39 -0400 Subject: [PATCH] cmd/dist: disable PGO for toolchain2 build Toolchain2 is only used for building toolchain3. We don't need to build it with PGO. And building with PGO causes packages to be built twice (one with PGO for the compiler, one without for other programs). Disable PGO for toolchain2. Also, I thought cmd/dist requires toolchain2 and toolchain3 compilers are identical binaries, so they need to be built in the same way. But it doesn't. Change-Id: Iaf49816da3dd06db79b48482c0e2435e09b512d7 Reviewed-on: https://go-review.googlesource.com/c/go/+/501335 TryBot-Result: Gopher Robot Reviewed-by: Michael Pratt Reviewed-by: Bryan Mills Run-TryBot: Cherry Mui --- src/cmd/dist/build.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cmd/dist/build.go b/src/cmd/dist/build.go index d920db9b88..8eb6daa3a5 100644 --- a/src/cmd/dist/build.go +++ b/src/cmd/dist/build.go @@ -1457,7 +1457,8 @@ func cmdbootstrap() { os.Setenv("CC", compilerEnvLookup("CC", defaultcc, goos, goarch)) // Now that cmd/go is in charge of the build process, enable GOEXPERIMENT. os.Setenv("GOEXPERIMENT", goexperiment) - goInstall(toolenv(), goBootstrap, toolchain...) + // No need to enable PGO for toolchain2. + goInstall(toolenv(), goBootstrap, append([]string{"-pgo=off"}, toolchain...)...) if debug { run("", ShowOutput|CheckExit, pathf("%s/compile", tooldir), "-V=full") copyfile(pathf("%s/compile2", tooldir), pathf("%s/compile", tooldir), writeExec) -- 2.50.0