]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/dist: disable PGO for toolchain2 build
authorCherry Mui <cherryyz@google.com>
Tue, 6 Jun 2023 20:53:39 +0000 (16:53 -0400)
committerCherry Mui <cherryyz@google.com>
Wed, 7 Jun 2023 16:03:15 +0000 (16:03 +0000)
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 <gobot@golang.org>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: Bryan Mills <bcmills@google.com>
Run-TryBot: Cherry Mui <cherryyz@google.com>

src/cmd/dist/build.go

index d920db9b886f004466b9ae9d803bc396ddabfee9..8eb6daa3a5de5aa8dde5e3d145ae5f223f5b9798 100644 (file)
@@ -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)