aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa
AgeCommit message (Collapse)Author
2023-01-26cmd/compile: improve register overwrite decision for resultInArg0 opsKeith Randall
When we're compiling a resultInArg0 op, we need to clobber the register containing the input value. So we first make a register copy of the input value. We can then clobber either of the two registers the value is in and still have the original input value in a register for future uses. Before this CL, we always clobbered the original, not the copy. But that's not always the right decision - if the original is already in a specific register that it needs to be in later (typically, a return value register), clobber the copy instead. This optimization can remove a mov instruction. It saves 1376 bytes of instructions in cmd/go. Redo of CL 460656, reverted at CL 463475, with a fix for s390x. The new code just ensures that the copied value is in a register which is a valid input register for the instruction. Change-Id: Id570b8a60a6d2da9090de80a90b6bb0266e9e38a Reviewed-on: https://go-review.googlesource.com/c/go/+/463221 Auto-Submit: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-01-25cmd: remove GOEXPERIMENT=nounified knobMatthew Dempsky
This CL removes the GOEXPERIMENT=nounified knob, and any conditional statements that depend on that knob. Further CLs to remove unreachable code follow this one. Updates #57410. Change-Id: I39c147e1a83601c73f8316a001705778fee64a91 Reviewed-on: https://go-review.googlesource.com/c/go/+/458615 Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-01-25Revert "cmd/compile: improve register overwrite decision for resultInArg0 ops"Keith Randall
This reverts CL 460656 Reason for revert: This breaks s390x. Change-Id: I8fada14fabc90593b8033ed11188c04963d2da75 Reviewed-on: https://go-review.googlesource.com/c/go/+/463475 Reviewed-by: Matthew Dempsky <mdempsky@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
2023-01-25cmd/compile: improve register overwrite decision for resultInArg0 opsKeith Randall
When we're compiling a resultInArg0 op, we need to clobber the register containing the input value. So we first make a register copy of the input value. We can then clobber either of the two registers the value is in and still have the original input value in a register for future uses. Before this CL, we always clobbered the original, not the copy. But that's not always the right decision - if the original is already in a specific register that it needs to be in later (typically, a return value register), clobber the copy instead. This optimization can remove a mov instruction. It saves 1376 bytes of instructions in cmd/go. Change-Id: I162870c84b9a180da6715bb24c296a902974fed3 Reviewed-on: https://go-review.googlesource.com/c/go/+/460656 Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com> Run-TryBot: Keith Randall <khr@golang.org>
2023-01-24Revert "cmd/compile: teach prove about bitwise OR operation"Keith Randall
This reverts commit 3680b5e9c4f42fcf9155aa42b3b344d1fbe19571. Reason for revert: causes long compile times on certain functions. See issue #57959 Change-Id: Ie9e881ca8abbc79a46de2bfeaed0b9d6c416ed42 Reviewed-on: https://go-review.googlesource.com/c/go/+/463295 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2023-01-23cmd/compile: teach prove about unsigned division, modulus and rshJorropo
Fixes: #57077 Change-Id: Icffcac42e28622eadecdba26e3cd7ceca6c4aacc Reviewed-on: https://go-review.googlesource.com/c/go/+/455095 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
2023-01-23cmd/compile: make loopbce handle 8, 16 and 32 bit induction variablesJakub Ciolek
Compute limits and increment values for all integer widths. Resolves 2 TODO's in loopbce.go compilecmp linux/amd64: compress/flate compress/flate.(*huffmanEncoder).bitCounts 1235 -> 1207 (-2.27%) cmd/internal/obj/wasm cmd/internal/obj/wasm.assemble 7443 -> 7303 (-1.88%) cmd/internal/obj/wasm.assemble.func1 165 -> 138 (-16.36%) cmd/link/internal/ld cmd/link/internal/ld.(*Link).findfunctab.func1 1646 -> 1627 (-1.15%) Change-Id: I2d79b7376eb67d6bcc8fdaf0c197c11e631562d0 Reviewed-on: https://go-review.googlesource.com/c/go/+/435258 Reviewed-by: Benny Siegert <bsiegert@gmail.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-01-21test: test that we schedule OpArgIntReg earlyKeith Randall
If OpArgIntReg is incorrectly scheduled, that causes it to be spilled incorrectly, which causes the argument to not be considered live at the start of the function. This is the test for CL 462858 Add a brief mention of why CL 462858 is needed in the scheduling code. Change-Id: Id199456f88d9ee5ca46d7b0353a3c2049709880e Reviewed-on: https://go-review.googlesource.com/c/go/+/462899 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
2023-01-20cmd/compile: ensure register args come before on-stack args in scheduleKeith Randall
The register allocator doesn't like OpArg coming in between other OpIntArg operations, as it doesn't put the spills in the right place in that situation. This is just a bug in the new scheduler, I didn't copy over the proper score from the old scheduler correctly. Change-Id: I3b4ee1754982fb360e99c5864b19e7408d60b5bc Reviewed-on: https://go-review.googlesource.com/c/go/+/462858 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-20cmd/compile: use a boolean as a avoid clobbering flags mov markerJakub Ciolek
The Value type implements Aux interface because it is being used as a "avoid clobbering flags" marker by amd64, x86 and s390x SSA parts. Create a boolean that implements the Aux interface. Use it as the marker instead. We no longer need Value to implement Aux. Resolves a TODO. See CL 275756 for more info. Change-Id: I8a1eddf7e738b8aa31e82f3c4c590bafd2cdc56b Reviewed-on: https://go-review.googlesource.com/c/go/+/461156 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-01-20cmd/compile: AMD64v3 remove unnecessary TEST comparision in isPowerOfTwoJorropo
With GOAMD64=V3 the canonical isPowerOfTwo function: func isPowerOfTwo(x uintptr) bool { return x&(x-1) == 0 } Used to compile to: temp := BLSR(x) // x&(x-1) flags = TEST(temp, temp) return flags.zf However the blsr instruction already set ZF according to the result. So we can remove the TEST instruction if we are just checking ZF. Such as in multiple pieces of code around memory allocations. This make the code smaller and faster. Change-Id: Ia12d5a73aa3cb49188c0b647b1eff7b56c5a7b58 Reviewed-on: https://go-review.googlesource.com/c/go/+/448255 Run-TryBot: Jakub Ciolek <jakub@ciolek.dev> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
2023-01-20cmd/compile: rewrite empty makeslice to zerobase pointerJorropo
make\(\[\][a-zA-Z0-9]+, 0\) is seen 52 times in the go source. And at least 391 times on internet: https://grep.app/search?q=make%5C%28%5C%5B%5C%5D%5Ba-zA-Z0-9%5D%2B%2C%200%5C%29&regexp=true This used to compile to calling runtime.makeslice. However we can copy what we do for []T{}, just use a zerobase pointer. On my machine this is 10x faster (from 3ns to 0.3ns). Note that an empty loop also runs in 0.3ns, so this really is free when you count superscallar execution. Change-Id: I1cfe7e69f5a7a4dabbc71912ce6a4f8a2d4a7f3c Reviewed-on: https://go-review.googlesource.com/c/go/+/454036 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Jakub Ciolek <jakub@ciolek.dev>
2023-01-20cmd/compile: improve scheduling passKeith Randall
Convert the scheduling pass from scheduling backwards to scheduling forwards. Forward scheduling makes it easier to prioritize scheduling values as soon as they are ready, which is important for things like nil checks, select ops, etc. Forward scheduling is also quite a bit clearer. It was originally backwards because computing uses is tricky, but I found a way to do it simply and with n lg n complexity. The new scheme also makes it easy to add new scheduling edges if needed. Fixes #42673 Update #56568 Change-Id: Ibbb38c52d191f50ce7a94f8c1cbd3cd9b614ea8b Reviewed-on: https://go-review.googlesource.com/c/go/+/270940 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
2023-01-20all: fix typos in go file commentsMarcel Meyer
This is the second round to look for spelling mistakes. This time the manual sifting of the result list was made easier by filtering out capitalized and camelcase words. grep -r --include '*.go' -E '^// .*$' . | aspell list | grep -E -x '[A-Za-z]{1}[a-z]*' | sort | uniq This PR will be imported into Gerrit with the title and first comment (this text) used to generate the subject and body of the Gerrit change. Change-Id: Ie8a2092aaa7e1f051aa90f03dbaf2b9aaf5664a9 GitHub-Last-Rev: fc2bd6e0c51652f13a7588980f1408af8e6080f5 GitHub-Pull-Request: golang/go#57737 Reviewed-on: https://go-review.googlesource.com/c/go/+/461595 Auto-Submit: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Robert Griesemer <gri@google.com>
2023-01-19cmd/compile: add memory argument to GetCallerSPKeith Randall
We need to make sure that when we get the stack pointer, we get it at the right time. V = GetCallerSP Call() W = GetCallerSP If Call causes a stack growth, then we will be in a situation where V != W. So it matters when GetCallerSP operations get scheduled. Add a memory argument to GetCallerSP so it can't be reordered with things like calls. Change-Id: I6cc801134c38e358c5a1ec0c09d38379a16a4184 Reviewed-on: https://go-review.googlesource.com/c/go/+/453515 Reviewed-by: Martin Möhrmann <moehrmann@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Martin Möhrmann <martin@golang.org> Reviewed-by: Robert Griesemer <gri@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-19cmd/compile: add anchored version of SPKeith Randall
The SPanchored opcode is identical to SP, except that it takes a memory argument so that it (and more importantly, anything that uses it) must be scheduled at or after that memory argument. This opcode ensures that a LEAQ of a variable gets scheduled after the corresponding VARDEF for that variable. This may lead to less CSE of LEAQ operations. The effect is very small. The go binary is only 80 bytes bigger after this CL. Usually LEAQs get folded into load/store operations, so the effect is only for pointerful types, large enough to need a duffzero, and have their address passed somewhere. Even then, usually the CSEd LEAQs will be un-CSEd because the two uses are on different sides of a function call and the LEAQ ends up being rematerialized at the second use anyway. Change-Id: Ib893562cd05369b91dd563b48fb83f5250950293 Reviewed-on: https://go-review.googlesource.com/c/go/+/452916 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-by: Martin Möhrmann <martin@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2023-01-19cmd/compile/internal/ssa: generate code via a //go:generate directiveDmitri Shuralyov
The standard way to generate code in a Go package is via //go:generate directives, which are invoked by the developer explicitly running: go generate import/path/of/said/package Switch to using that approach here. This way, developers don't need to learn and remember a custom way that each particular Go package may choose to implement its code generation. It also enables conveniences such as 'go generate -n' to discover how code is generated without running anything (this works on all packages that rely on //go:generate directives), being able to generate multiple packages at once and from any directory, and so on. Change-Id: I0e5b6a1edeff670a8e588befeef0c445613803c7 Reviewed-on: https://go-review.googlesource.com/c/go/+/460135 Reviewed-by: Dmitri Shuralyov <dmitshur@google.com> Reviewed-by: Keith Randall <khr@google.com> Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org> Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2023-01-17cmd/dist: make toolchain build reproducibleRuss Cox
- Build cmd with CGO_ENABLED=0. Doing so removes the C compiler toolchain from the reproducibility perimeter and also results in cmd/go and cmd/pprof binaries that are statically linked, so that they will run on a wider variety of systems. In particular the Linux versions will run on Alpine and NixOS without needing a simulation of libc.so.6. The potential downside of disabling cgo is that cmd/go and cmd/pprof use the pure Go network resolver instead of the host resolver on Unix systems. This means they will not be able to use non-DNS resolver mechanisms that may be specified in /etc/resolv.conf, such as mDNS. Neither program seems likely to need non-DNS names like those, however. macOS and Windows systems still use the host resolver, which they access without cgo. - Build cmd with -trimpath when building a release. Doing so removes $GOPATH from the file name prefixes stored in the binary, so that the build directory does not leak into the final artifacts. - When CC and CXX are empty, do not pick values to hard-code into the source tree and binaries. Instead, emit code that makes the right decision at runtime. In addition to reproducibility, this makes cross-compiled toolchains work better. A macOS toolchain cross-compiled on Linux will now correctly look for clang, instead of looking for gcc because it was built on Linux. - Convert \ to / in file names stored in .a files. These are converted to / in the final binaries, but the hashes of the .a files affect the final build ID of the binaries. Without this change, builds of a Windows toolchain on Windows and non-Windows machines produce identical binaries except for the input hash part of the build ID. - Due to the conversion of \ to / in .a files, convert back when reading inline bodies on Windows to preserve output file names in error messages. Combined, these four changes (along with Go 1.20's removal of installed pkg/**.a files and conversion of macOS net away from cgo) make the output of make.bash fully reproducible, even when cross-compiling: a released macOS toolchain built on Linux or Windows will contain exactly the same bits as a released macOS toolchain built on macOS. The word "released" in the previous sentence is important. For the build IDs in the binaries to work out the same on both systems, a VERSION file must exist to provide a consistent compiler build ID (instead of using a content hash of the binary). For #24904. Fixes #57007. Change-Id: I665e1ef4ff207d6ff469452347dca5bfc81050e6 Reviewed-on: https://go-review.googlesource.com/c/go/+/454836 Reviewed-by: Bryan Mills <bcmills@google.com> Run-TryBot: Russ Cox <rsc@golang.org> Auto-Submit: Russ Cox <rsc@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-17cmd/compile: ensure temp register mask isn't emptyKeith Randall
We need to avoid nospill registers at this point in regalloc. Make sure that we don't restrict our register set to avoid registers desired by other instructions, if the resulting set includes only nospill registers. Fixes #57846 Change-Id: I05478e4513c484755dc2e8621d73dac868e45a27 Reviewed-on: https://go-review.googlesource.com/c/go/+/461685 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2023-01-09cmd/compile: prevent IsNewObject from taking quadratic timeKeith Randall
As part of IsNewObject, we need to go from the SelectN[0] use of a call to the SelectN[1] use of a call. The current code does this by just looking through the block. If the block is very large, this ends up taking quadratic time. Instead, prepopulate a map from call -> SelectN[1] user of that call. That lets us find the SelectN[1] user in constant time. Fixes #57657 Change-Id: Ie2e0b660af5c080314f4f17ba2838510a1147f9e Reviewed-on: https://go-review.googlesource.com/c/go/+/461080 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
2022-12-17cmd/compile: sign-extend the 2nd argument of the LoweredAtomicCas32 on ↵Guoqi Chen
loong64,mips64x,riscv64 The function LoweredAtomicCas32 is implemented using the LL-SC instruction pair on loong64, mips64x, riscv64. However,the LL instruction on loong64, mips64x, riscv64 is sign-extended, so it is necessary to sign-extend the 2nd parameter "old" of the LoweredAtomicCas32, so that the instruction BNE after LL can get the desired result. The function prototype of LoweredAtomicCas32 in golang: func Cas32(ptr *uint32, old, new uint32) bool When using an intrinsify implementation: case 1: (*ptr) <= 0x80000000 && old < 0x80000000 E.g: (*ptr) = 0x7FFFFFFF, old = Rarg1= 0x7FFFFFFF After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0x7FFFFFFF Rtmp ! = Rarg1(old) is false, the result we expect case 2: (*ptr) >= 0x80000000 && old >= 0x80000000 E.g: (*ptr) = 0x80000000, old = Rarg1= 0x80000000 After run the instruction "LL (Rarg0), Rtmp": Rtmp = 0xFFFFFFFF_80000000 Rtmp ! = Rarg1(old) is true, which we do not expect When using an non-intrinsify implementation: Because Rarg1 is loaded from the stack using sign-extended instructions ld.w, the situation described in Case 2 above does not occur Benchmarks on linux/loong64: name old time/op new time/op delta Cas 50.0ns ± 0% 50.1ns ± 0% ~ (p=1.000 n=1+1) Cas64 50.0ns ± 0% 50.1ns ± 0% ~ (p=1.000 n=1+1) Cas-4 56.0ns ± 0% 56.0ns ± 0% ~ (p=1.000 n=1+1) Cas64-4 56.0ns ± 0% 56.0ns ± 0% ~ (p=1.000 n=1+1) Benchmarks on Loongson 3A4000 (GOARCH=mips64le, 1.8GHz) name old time/op new time/op delta Cas 70.4ns ± 0% 70.3ns ± 0% ~ (p=1.000 n=1+1) Cas64 70.7ns ± 0% 70.6ns ± 0% ~ (p=1.000 n=1+1) Cas-4 81.1ns ± 0% 80.8ns ± 0% ~ (p=1.000 n=1+1) Cas64-4 80.9ns ± 0% 80.9ns ± 0% ~ (p=1.000 n=1+1) Fixes #57282 Change-Id: I190a7fc648023b15fa392f7fdda5ac18c1561bac Reviewed-on: https://go-review.googlesource.com/c/go/+/457135 Run-TryBot: Than McIntosh <thanm@google.com> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Than McIntosh <thanm@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-12-11cmd/compile: fix conditional move rule on PPC64Keith Randall
Similar to CL 456556 but for ppc64 instead of arm64. Change docs about how booleans are stored in registers for ppc64. We now don't promise to keep the upper bits zeroed; they might be junk. To test, I changed the boolean generation instructions (MOVBZload* and ISEL* with boolean type) to OR in 0x100 to the result. all.bash still passed, so I think nothing else is depending on the upper bits of booleans. Update #57184 Change-Id: Ie66f8934a0dafa34d0a8c2a37324868d959a852c Reviewed-on: https://go-review.googlesource.com/c/go/+/456437 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: KAMPANAT THUMWONG (KONG PC) <1992kongpc.kth@gmail.com> Run-TryBot: Archana Ravindar <aravind5@in.ibm.com>
2022-12-09cmd/compile: fix conditional select ruleKeith Randall
ARM64 maintains booleans in the low byte of registers. Upper parts of that register are junk. This rule is using all 32 bits of a boolean-containing register, which is wrong. Change the rule to only look at the low bit. Fixes #57184 Change-Id: Ibbef86b2be859df3d06d993db00e1231c481c428 Reviewed-on: https://go-review.googlesource.com/c/go/+/456556 Auto-Submit: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Keith Randall <khr@golang.org>
2022-12-05cmd/compile: clean up amd64 opcode commentsKeith Randall
Put comments about what operations do per block of related opcodes instead of on each line. This is less repetitive and lets us be a bit more verbose in our descriptions. Doesn't change the generated code at all. Change-Id: I98fbd4029df6537b10aac2113a00df121d0fca1b Reviewed-on: https://go-review.googlesource.com/c/go/+/433736 Auto-Submit: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-12-03all: fix some comments for methodcui fliter
Change-Id: I4cff6b2a1fed6acdf754539c3c53a61eaa3b3f84 Reviewed-on: https://go-review.googlesource.com/c/go/+/450176 Auto-Submit: Ian Lance Taylor <iant@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Ian Lance Taylor <iant@golang.org> Reviewed-by: Martin Möhrmann <moehrmann@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Ian Lance Taylor <iant@golang.org>
2022-11-30cmd/compile: disallow CMOV optimization with ptr arithmetic as an argKeith Randall
if q != nil { p = &q.f } Which gets rewritten to a conditional move: tmp := &q.f p = Select q!=nil, tmp, p Unfortunately, we can't compute &q.f before we've checked if q is nil, because if it is nil, &q.f is an invalid pointer (if f's offset is nonzero but small). Normally this is not a problem because the tmp variable above immediately dies, and is thus not live across any safepoint. However, if later there is another &q.f computation, those two computations are CSEd, causing tmp to be used at both use points. That will extend tmp's lifetime, possibly across a call. Fixes #56990 Change-Id: I3ea31be93feae04fbe3304cb11323194c5df3879 Reviewed-on: https://go-review.googlesource.com/c/go/+/454155 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-11-18all: add missing periods in commentscui fliter
Change-Id: I69065f8adf101fdb28682c55997f503013a50e29 Reviewed-on: https://go-review.googlesource.com/c/go/+/449757 Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Joedian Reid <joedian@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Joedian Reid <joedian@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com>
2022-11-18cmd/compile: fix wrong optimization for eliding Not in PhiWayne Zuo
The previous rule may move the phi value into a wrong block. This CL make it only rewrite the phi value not the If block, so that the phi value will stay in old block. Fixes #56777 Change-Id: I9479a5c7f28529786968413d35b82a16181bb1f1 Reviewed-on: https://go-review.googlesource.com/c/go/+/451496 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-11-17cmd/compile: teach regalloc about temporary registersKeith Randall
Temporary registers are sometimes needed for an architecture backend which needs to use several machine instructions to implement a single SSA instruction. Mark such instructions so that regalloc can reserve the temporary register for it. That way we don't have to reserve a fixed register like we do now. Convert the temp-register-using instructions on amd64 to use this new mechanism. Other archs can follow as needed. Change-Id: I1d0c8588afdad5cd18b4398eb5a0f755be5dead7 Reviewed-on: https://go-review.googlesource.com/c/go/+/398556 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com>
2022-11-16cmd/compile: elide unnecessary Not in Phi block controlsJakub Ciolek
For a BlockIf, we can change the order of the successors if all OpPhi args are an OpNot and this allows us to elide said OpNots. When compiling Go itself, there were no hits for (If (Phi (Not x) (Not y) (Not z)) or any other longer patterns. compilecmp: errors errors.As changed reflect reflect.Value.FieldByIndex changed reflect.Value.Method changed reflect.cvtI2I changed reflect.Value.FieldByIndexErr changed reflect.deepValueEqual.func1 496 -> 502 (+1.21%) reflect.deepValueEqual changed internal/fmtsort internal/fmtsort.nilCompare 652 -> 648 (-0.61%) database/sql database/sql.convertAssignRows changed encoding/json encoding/json.interfaceEncoder changed encoding/json.(*decodeState).unmarshal 574 -> 571 (-0.52%) encoding/json.mapEncoder.encode changed encoding/json.ptrEncoder.encode changed encoding/json.encodeByteSlice changed encoding/json.addrMarshalerEncoder changed encoding/json.addrTextMarshalerEncoder changed encoding/json.(*decodeState).object changed encoding/json.sliceEncoder.encode changed encoding/json.indirect 1303 -> 1286 (-1.30%) encoding/gob encoding/gob.encOpFor.func3 changed encoding/gob.encIndirect changed encoding/gob.encOpFor.func5 changed encoding/gob.(*Encoder).encodeInterface changed encoding/gob.(*Decoder).decodeMap changed encoding/xml encoding/xml.(*printer).marshalStruct changed encoding/xml.(*fieldInfo).value changed encoding/xml.(*printer).marshalAttr changed encoding/xml.indirect changed encoding/xml.(*printer).marshalValue changed encoding/asn1 encoding/asn1.UnmarshalWithParams 837 -> 845 (+0.96%) text/template text/template.indirectInterface changed text/template.indirect changed text/template.safeCall changed net/http/httptrace net/http/httptrace.(*ClientTrace).compose changed cmd/fix main.typefix.func2 changed cmd/compile/internal/ir cmd/compile/internal/ir.dumpNode changed cmd/gofmt main.match changed main.subst changed cmd/compile/internal/ssa cmd/compile/internal/ssa.rewriteBlockgeneric 626 -> 1030 (+64.54%) Change-Id: I645b3b3e37302a63e06b79ce74674882fb603ef3 Reviewed-on: https://go-review.googlesource.com/c/go/+/449055 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Joedian Reid <joedian@golang.org> Run-TryBot: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-11-15cmd/compile: use testenv.Command instead of exec.Command in testsBryan C. Mills
testenv.Command sets a default timeout based on the test's deadline and sends SIGQUIT (where supported) in case of a hang. Change-Id: I084b324a20d5ecf733b2cb95f160947a7410a805 Reviewed-on: https://go-review.googlesource.com/c/go/+/450696 Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Auto-Submit: Bryan Mills <bcmills@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2022-11-15cmd/compile: add testing-flag guard to package-is-collected assertDavid Chase
On advice of the department of garbage collection, forcing a garbage collection generally does not improve performance. However, this-data-is-now-unreachable is a good property to be able to test, and that requires finalizers and a forced GC. So, to save build time, this test was removed from the compiler itself, but to verify the property, it was added to the fma_test (and the end-to-end dependence on the flag was tested with an inserted failure in testing the test). TODO: also turn on the new -d=gccheck=1 debug flag on the ssacheck builder. Benchmarking reveals that it is profitable to avoid this GC, with about 1.5% reduction in both user and wall time. (48 p) https://perf.golang.org/search?q=upload:20221103.3 (12 p) https://perf.golang.org/search?q=upload:20221103.5 Change-Id: I4c4816d619735838a32388acf0cc5eb1cd5f0db5 Reviewed-on: https://go-review.googlesource.com/c/go/+/447359 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: David Chase <drchase@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org>
2022-11-15cmd/compile: remove manually implemented popcount in _gen/main.goJorropo
Change-Id: I7b4da26bace15c2b632c2dbfe56cc2799bbfdb02 Reviewed-on: https://go-review.googlesource.com/c/go/+/450058 Reviewed-by: Martin Möhrmann <moehrmann@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Keith Randall <khr@golang.org>
2022-11-14cmd/compile: merge zero constant ISEL in PPC64 lateLower passPaul E. Murphy
Add a new SSA opcode ISELZ, similar to ISELB to represent a select of value or 0. Then, merge candidate ISEL opcodes inside the late lower pass. This avoids complicating rules within the the lower pass. Change-Id: I3b14c94b763863aadc834b0e910a85870c131313 Reviewed-on: https://go-review.googlesource.com/c/go/+/442596 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Lynn Boger <laboger@linux.vnet.ibm.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> Reviewed-by: Joedian Reid <joedian@golang.org>
2022-11-11all: fix problematic commentscui fliter
Change-Id: Ib6ea1bd04d9b06542ed2b0f453c718115417c62c Reviewed-on: https://go-review.googlesource.com/c/go/+/449755 Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Ian Lance Taylor <iant@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Ian Lance Taylor <iant@google.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Keith Randall <khr@google.com>
2022-11-11cmd/compile: remove output registers limit for MUL/DIV on loong64Wayne Zuo
This limitation exists on MIPS platform, but not on loong64. Change-Id: I14bb3ec6895a8f7850873c171e1756843ffea72e Reviewed-on: https://go-review.googlesource.com/c/go/+/449395 Reviewed-by: Michael Knyszek <mknyszek@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: David Chase <drchase@google.com>
2022-11-10cmd/compile: teach prove about signed domain relations of constant integer Phi'sJakub Ciolek
Implement extracting signed domain relations for OpPhi's composed entirely of integer constants. darwin/arm benches (M1 Pro): EqIfaceConcrete-10 0.83ns ± 0% 0.78ns ± 0% -6.52% p=0.000 n=8+9 ) ConvT2EByteSized/bool-10 1.33ns ± 0% 1.25ns ± 0% -6.4% ( p=0.000 n=9+8 ) ConvT2EByteSized/uint8-10 1.27ns ± 1% 1.25ns ± 0% -1.82%( p=0.000 n=8+8 ) ConvT2ESmall-10 2.18ns ± 0% 2.14ns ± 1% -1.97%( p=0.000 n=9+9 ) compilecmp linux/amd64 reports a 1.4% reduction in total size: file before after Δ % unicode/utf8.s 4251 4317 +66 +1.553% runtime/internal/sys.s 599 593 -6 -1.002% sync/atomic.s 2277 1695 -582 -25.560% internal/cpu.s 5412 5249 -163 -3.012% internal/abi.s 1006 1045 +39 +3.877% container/list.s 4821 4858 +37 +0.767% unicode/utf16.s 1162 868 -294 -25.301% hash/maphash.s 2525 2625 +100 +3.960% image/color.s 7414 7045 -369 -4.977% math.s 37278 37246 -32 -0.086% math/cmplx.s 8868 8876 +8 +0.090% runtime.s 496893 486910 -9983 -2.009% runtime/metrics.s 1145 1165 +20 +1.747% sync.s 14257 15049 +792 +5.555% internal/singleflight.s 2557 2576 +19 +0.743% internal/reflectlite.s 59715 21713 -38002 -63.639% math/rand.s 10153 9980 -173 -1.704% path.s 6007 6091 +84 +1.398% sort.s 20704 20717 +13 +0.063% io.s 19708 18899 -809 -4.105% container/heap.s 1922 1932 +10 +0.520% cmd/vendor/golang.org/x/mod/semver.s 8013 7922 -91 -1.136% strconv.s 50530 49955 -575 -1.138% vendor/golang.org/x/net/dns/dnsmessage.s 79054 80314 +1260 +1.594% bytes.s 31195 31448 +253 +0.811% text/tabwriter.s 8952 9037 +85 +0.950% strings.s 43052 41627 -1425 -3.310% crypto/internal/nistec/fiat.s 124219 123197 -1022 -0.823% syscall.s 85224 84600 -624 -0.732% hash/adler32.s 1224 1221 -3 -0.245% encoding/ascii85.s 4131 4149 +18 +0.436% hash/crc32.s 6304 6347 +43 +0.682% encoding/base32.s 8466 8473 +7 +0.083% vendor/golang.org/x/text/transform.s 15633 16050 +417 +2.667% bufio.s 24464 22091 -2373 -9.700% reflect.s 258373 164941 -93432 -36.162% internal/syscall/unix.s 1730 1299 -431 -24.913% go/build/constraint.s 12959 13581 +622 +4.800% hash/crc64.s 3604 3673 +69 +1.915% hash/fnv.s 4482 4609 +127 +2.834% compress/bzip2.s 9586 9891 +305 +3.182% time.s 92081 89953 -2128 -2.311% regexp/syntax.s 78123 78293 +170 +0.218% internal/saferio.s 1746 1635 -111 -6.357% html.s 4228 4233 +5 +0.118% encoding/binary.s 31383 31282 -101 -0.322% image.s 37513 38082 +569 +1.517% internal/poll.s 45486 43956 -1530 -3.364% context.s 11096 10804 -292 -2.632% io/fs.s 16921 18609 +1688 +9.976% regexp.s 58983 58790 -193 -0.327% crypto/cipher.s 18686 18718 +32 +0.171% crypto/internal/edwards25519/field.s 9473 9488 +15 +0.158% crypto/sha1.s 6477 6537 +60 +0.926% encoding/base64.s 10615 10215 -400 -3.768% vendor/golang.org/x/crypto/internal/poly1305.s 4522 4567 +45 +0.995% cmd/internal/sys.s 4729 4965 +236 +4.990% os.s 53819 53697 -122 -0.227% embed.s 6428 6437 +9 +0.140% crypto/des.s 5770 5762 -8 -0.139% encoding/pem.s 6425 6467 +42 +0.654% crypto/internal/edwards25519.s 31850 31948 +98 +0.308% image/draw.s 28660 28594 -66 -0.230% image/jpeg.s 32246 32385 +139 +0.431% index/suffixarray.s 38665 38627 -38 -0.098% crypto/hmac.s 2546 2437 -109 -4.281% fmt.s 70412 71396 +984 +1.397% crypto/sha256.s 5708 5683 -25 -0.438% crypto/sha512.s 8346 8313 -33 -0.395% crypto/aes.s 11586 11231 -355 -3.064% path/filepath.s 16499 16438 -61 -0.370% crypto/internal/nistec.s 65640 65713 +73 +0.111% internal/lazyregexp.s 2389 2284 -105 -4.395% internal/intern.s 2988 3266 +278 +9.304% os/user.s 12166 12106 -60 -0.493% compress/lzw.s 7292 7264 -28 -0.384% encoding/hex.s 5431 5405 -26 -0.479% compress/flate.s 46812 47932 +1120 +2.393% net/url.s 26853 26638 -215 -0.801% crypto/ecdh.s 10015 12228 +2213 +22.097% vendor/golang.org/x/sys/cpu.s 5877 5599 -278 -4.730% database/sql/driver.s 16553 16671 +118 +0.713% net/netip.s 39077 40164 +1087 +2.782% debug/plan9obj.s 6765 6679 -86 -1.271% math/big.s 160530 161099 +569 +0.354% archive/tar.s 59285 59692 +407 +0.687% debug/dwarf.s 117589 116367 -1222 -1.039% compress/gzip.s 8288 8255 -33 -0.398% archive/zip.s 51813 49835 -1978 -3.818% compress/zlib.s 6206 6209 +3 +0.048% runtime/debug.s 11995 12212 +217 +1.809% database/sql.s 91280 90859 -421 -0.461% crypto/dsa.s 4816 4784 -32 -0.664% net.s 272116 271353 -763 -0.280% crypto/elliptic.s 30485 32898 +2413 +7.915% encoding/asn1.s 47189 48186 +997 +2.113% crypto/rand.s 3812 3801 -11 -0.289% debug/macho.s 30712 27800 -2912 -9.482% debug/pe.s 23198 23542 +344 +1.483% debug/elf.s 50653 50335 -318 -0.628% internal/xcoff.s 18330 18578 +248 +1.353% debug/gosym.s 37011 34275 -2736 -7.392% encoding/csv.s 11440 11497 +57 +0.498% encoding/json.s 95650 92269 -3381 -3.535% vendor/golang.org/x/crypto/cryptobyte.s 31261 31418 +157 +0.502% encoding/gob.s 131648 132481 +833 +0.633% crypto/x509/pkix.s 9030 9285 +255 +2.824% crypto/rsa.s 25753 25620 -133 -0.516% debug/buildinfo.s 7329 7360 +31 +0.423% log.s 12153 12554 +401 +3.300% encoding/xml.s 90630 91544 +914 +1.008% net/textproto.s 17674 15707 -1967 -11.129% vendor/golang.org/x/text/unicode/norm.s 66104 66296 +192 +0.290% vendor/golang.org/x/net/http2/hpack.s 23542 24291 +749 +3.182% mime/quotedprintable.s 5074 5106 +32 +0.631% mime.s 32982 32673 -309 -0.937% net/http/internal.s 5765 4748 -1017 -17.641% flag.s 25247 25434 +187 +0.741% vendor/golang.org/x/text/unicode/bidi.s 30444 30707 +263 +0.864% go/token.s 13689 14075 +386 +2.820% go/doc/comment.s 49201 47717 -1484 -3.016% internal/buildcfg.s 10468 9949 -519 -4.958% text/scanner.s 9812 9814 +2 +0.020% os/exec.s 34367 29498 -4869 -14.168% mime/multipart.s 17568 17083 -485 -2.761% image/gif.s 22965 22826 -139 -0.605% crypto/x509.s 142551 139844 -2707 -1.899% text/template/parse.s 82771 94885 +12114 +14.636% go/scanner.s 17306 17321 +15 +0.087% internal/dag.s 13123 13368 +245 +1.867% go/constant.s 29736 32872 +3136 +10.546% image/png.s 37126 37013 -113 -0.304% internal/goroot.s 3080 3212 +132 +4.286% internal/diff.s 7561 7909 +348 +4.603% vendor/golang.org/x/net/idna.s 22454 22493 +39 +0.174% go/ast.s 63945 68792 +4847 +7.580% internal/pkgbits.s 19638 19838 +200 +1.018% text/template.s 107139 100338 -6801 -6.348% runtime/trace.s 2844 2762 -82 -2.883% internal/txtar.s 2495 2483 -12 -0.481% internal/profile.s 117110 118516 +1406 +1.201% log/syslog.s 6615 6625 +10 +0.151% vendor/golang.org/x/net/http/httpguts.s 3558 3580 +22 +0.618% crypto/tls.s 298298 292244 -6054 -2.030% internal/trace.s 69626 67477 -2149 -3.086% vendor/golang.org/x/net/http/httpproxy.s 8164 7942 -222 -2.719% go/doc.s 69092 71449 +2357 +3.411% go/internal/typeparams.s 1465 1338 -127 -8.669% go/printer.s 90427 82948 -7479 -8.271% html/template.s 91720 90853 -867 -0.945% runtime/pprof.s 70261 69793 -468 -0.666% testing.s 107098 98982 -8116 -7.578% net/internal/socktest.s 15715 15469 -246 -1.565% net/mail.s 17762 18044 +282 +1.588% net/smtp.s 11295 11484 +189 +1.673% os/signal.s 7647 7779 +132 +1.726% go/parser.s 111336 116170 +4834 +4.342% testing/iotest.s 13339 13379 +40 +0.300% testing/quick.s 8493 8516 +23 +0.271% cmd/internal/bio.s 11994 8754 -3240 -27.014% internal/testenv.s 7067 6779 -288 -4.075% vendor/golang.org/x/net/nettest.s 27692 27770 +78 +0.282% cmd/internal/objabi.s 15031 14718 -313 -2.082% cmd/internal/src.s 14507 14515 +8 +0.055% cmd/vendor/golang.org/x/arch/arm/armasm.s 33278 33864 +586 +1.761% go/format.s 4517 4725 +208 +4.605% go/build.s 67444 70250 +2806 +4.160% testing/fstest.s 53785 52941 -844 -1.569% cmd/vendor/golang.org/x/arch/arm64/arm64asm.s 86346 87156 +810 +0.938% cmd/internal/goobj.s 12262 12327 +65 +0.530% internal/fuzz.s 88446 89608 +1162 +1.314% cmd/vendor/golang.org/x/arch/ppc64/ppc64asm.s 36435 37026 +591 +1.622% cmd/internal/dwarf.s 28919 29476 +557 +1.926% cmd/internal/edit.s 3375 3428 +53 +1.570% cmd/vendor/golang.org/x/arch/x86/x86asm.s 70465 70187 -278 -0.395% cmd/internal/pkgpath.s 4922 4422 -500 -10.158% net/http.s 548512 541160 -7352 -1.340% cmd/internal/archive.s 11103 11111 +8 +0.072% testing/internal/testdeps.s 6384 6427 +43 +0.674% cmd/internal/quoted.s 2374 2708 +334 +14.069% cmd/compile/internal/abt.s 15188 14795 -393 -2.588% cmd/internal/gcprog.s 6090 6131 +41 +0.673% cmd/internal/codesign.s 4395 4406 +11 +0.250% go/types.s 478152 479038 +886 +0.185% cmd/internal/obj.s 121049 114662 -6387 -5.276% cmd/compile/internal/syntax.s 157912 156897 -1015 -0.643% expvar.s 8906 8586 -320 -3.593% net/http/cgi.s 17411 17782 +371 +2.131% net/http/cookiejar.s 13763 13931 +168 +1.221% net/http/httptest.s 16213 16785 +572 +3.528% net/http/pprof.s 14556 14739 +183 +1.257% net/http/httputil.s 43808 44406 +598 +1.365% net/rpc.s 32868 30581 -2287 -6.958% go/internal/gccgoimporter.s 45024 45409 +385 +0.855% go/internal/gcimporter.s 58540 53044 -5496 -9.388% go/internal/srcimporter.s 10011 10451 +440 +4.395% net/http/fcgi.s 18344 18039 -305 -1.663% cmd/internal/objfile.s 45853 46153 +300 +0.654% cmd/api.s 34943 35806 +863 +2.470% cmd/internal/obj/arm.s 61126 61156 +30 +0.049% net/rpc/jsonrpc.s 5601 5271 -330 -5.892% cmd/internal/obj/loong64.s 45594 45335 -259 -0.568% cmd/internal/obj/arm64.s 140572 140006 -566 -0.403% cmd/internal/obj/mips.s 53672 53637 -35 -0.065% go/importer.s 1989 2169 +180 +9.050% cmd/internal/obj/riscv.s 56721 56877 +156 +0.275% cmd/addr2line.s 1930 1906 -24 -1.244% cmd/internal/obj/ppc64.s 137317 115306 -22011 -16.029% cmd/internal/obj/wasm.s 34091 34162 +71 +0.208% cmd/internal/obj/s390x.s 110244 110444 +200 +0.181% cmd/asm/internal/flags.s 2234 2351 +117 +5.237% cmd/internal/obj/x86.s 86811 87534 +723 +0.833% cmd/internal/buildid.s 17303 17156 -147 -0.850% cmd/compile/internal/base.s 29582 29675 +93 +0.314% cmd/compile/internal/logopt.s 9859 9943 +84 +0.852% cmd/cgo.s 198958 203063 +4105 +2.063% cmd/internal/browser.s 1751 1803 +52 +2.970% cmd/vendor/golang.org/x/tools/cover.s 9752 9759 +7 +0.072% cmd/asm/internal/lex.s 22668 21352 -1316 -5.806% cmd/asm/internal/arch.s 27642 29863 +2221 +8.035% cmd/compile/internal/bitvec.s 5535 5542 +7 +0.126% cmd/compile/internal/types.s 74646 74488 -158 -0.212% cmd/dist.s 185287 184450 -837 -0.452% cmd/compile/internal/types2.s 477270 470783 -6487 -1.359% cmd/cover.s 29563 31341 +1778 +6.014% cmd/doc.s 54013 53299 -714 -1.322% cmd/go/internal/fsys.s 16751 16944 +193 +1.152% cmd/fix.s 64367 65866 +1499 +2.329% cmd/asm/internal/asm.s 60266 60767 +501 +0.831% cmd/compile/internal/ir.s 252952 187941 -65011 -25.701% cmd/go/internal/str.s 3582 3690 +108 +3.015% cmd/go/internal/lockedfile/internal/filelock.s 2062 1960 -102 -4.947% cmd/go/internal/cfg.s 11331 11253 -78 -0.688% cmd/asm.s 2461 2474 +13 +0.528% cmd/compile/internal/deadcode.s 5576 5812 +236 +4.232% cmd/compile/internal/objw.s 5553 5450 -103 -1.855% cmd/go/internal/par.s 4473 4378 -95 -2.124% cmd/compile/internal/abi.s 19219 19382 +163 +0.848% cmd/go/internal/lockedfile.s 22412 14422 -7990 -35.651% cmd/go/internal/auth.s 2218 2250 +32 +1.443% cmd/vendor/golang.org/x/mod/internal/lazyregexp.s 2389 2284 -105 -4.395% cmd/go/internal/base.s 10079 10177 +98 +0.972% cmd/go/internal/imports.s 16417 16159 -258 -1.572% cmd/go/internal/trace.s 4888 4895 +7 +0.143% cmd/go/internal/web.s 12130 12007 -123 -1.014% cmd/vendor/golang.org/x/mod/sumdb/tlog.s 27662 28441 +779 +2.816% cmd/vendor/golang.org/x/mod/module.s 20503 20758 +255 +1.244% cmd/vendor/golang.org/x/mod/sumdb/dirhash.s 3599 3601 +2 +0.056% cmd/go/internal/cache.s 23949 24705 +756 +3.157% cmd/go/internal/cmdflag.s 3769 3748 -21 -0.557% cmd/go/internal/search.s 15584 15917 +333 +2.137% cmd/vendor/golang.org/x/mod/sumdb/note.s 14260 14347 +87 +0.610% cmd/internal/test2json.s 8706 8575 -131 -1.505% cmd/go/internal/tool.s 2762 2756 -6 -0.217% cmd/vendor/golang.org/x/mod/zip.s 36841 37335 +494 +1.341% cmd/go/internal/mvs.s 27581 30511 +2930 +10.623% cmd/go/internal/modfetch/codehost.s 80858 76219 -4639 -5.737% cmd/go/internal/version.s 3050 3046 -4 -0.131% cmd/vendor/golang.org/x/mod/modfile.s 99002 98074 -928 -0.937% cmd/go/internal/test/internal/genflags.s 2025 2032 +7 +0.346% cmd/vendor/golang.org/x/sync/semaphore.s 2220 2210 -10 -0.450% cmd/go/internal/vcs.s 43959 45346 +1387 +3.155% cmd/vendor/golang.org/x/mod/sumdb.s 27952 28265 +313 +1.120% cmd/go/internal/modindex.s 79377 82223 +2846 +3.585% cmd/compile/internal/typecheck.s 317102 310352 -6750 -2.129% cmd/link/internal/benchmark.s 3621 3680 +59 +1.629% cmd/link/internal/sym.s 1816 1805 -11 -0.606% cmd/go/internal/modconv.s 14909 14895 -14 -0.094% cmd/gofmt.s 29575 29779 +204 +0.690% cmd/link/internal/dwtest.s 3879 3909 +30 +0.773% cmd/vendor/golang.org/x/sys/unix.s 118975 119232 +257 +0.216% cmd/nm.s 4675 4718 +43 +0.920% cmd/go/internal/modfetch.s 111400 112088 +688 +0.618% cmd/compile/internal/compare.s 11311 10693 -618 -5.464% cmd/compile/internal/staticdata.s 14014 14277 +263 +1.877% cmd/compile/internal/devirtualize.s 2548 2144 -404 -15.856% cmd/compile/internal/inline.s 37591 37993 +402 +1.069% cmd/compile/internal/escape.s 69777 68692 -1085 -1.555% cmd/compile/internal/importer.s 52920 48544 -4376 -8.269% cmd/internal/osinfo.s 501 698 +197 +39.321% cmd/link/internal/loader.s 79034 75315 -3719 -4.706% cmd/pack.s 8512 8600 +88 +1.034% cmd/vendor/github.com/google/pprof/internal/elfexec.s 5636 5711 +75 +1.331% cmd/vendor/github.com/google/pprof/profile.s 143898 145834 +1936 +1.345% cmd/compile/internal/reflectdata.s 80184 81399 +1215 +1.515% cmd/vendor/golang.org/x/term.s 24431 24478 +47 +0.192% cmd/go/internal/modload.s 273375 282247 +8872 +3.245% cmd/link/internal/loadpe.s 19813 17572 -2241 -11.311% cmd/link/internal/loadmacho.s 20848 20767 -81 -0.389% cmd/link/internal/loadelf.s 24458 23896 -562 -2.298% cmd/link/internal/loadxcoff.s 11183 8913 -2270 -20.299% cmd/vendor/github.com/ianlancetaylor/demangle.s 264095 268313 +4218 +1.597% cmd/compile/internal/staticinit.s 13176 13292 +116 +0.880% cmd/go/internal/help.s 5180 5320 +140 +2.703% cmd/go/internal/workcmd.s 17702 17368 -334 -1.887% cmd/test2json.s 1581 1427 -154 -9.741% cmd/vendor/github.com/google/pprof/internal/measurement.s 8449 8700 +251 +2.971% cmd/go/internal/load.s 123087 125064 +1977 +1.606% cmd/vendor/golang.org/x/tools/internal/analysisinternal.s 11481 12506 +1025 +8.928% cmd/vendor/golang.org/x/tools/internal/typeparams.s 15239 15796 +557 +3.655% cmd/vendor/github.com/google/pprof/internal/symbolz.s 4760 4805 +45 +0.945% cmd/vendor/github.com/google/pprof/internal/binutils.s 37975 37526 -449 -1.182% cmd/vendor/github.com/google/pprof/internal/graph.s 47850 47968 +118 +0.247% cmd/go/internal/fmtcmd.s 2319 2373 +54 +2.329% cmd/vendor/github.com/google/pprof/internal/symbolizer.s 10195 10268 +73 +0.716% cmd/vendor/golang.org/x/tools/go/analysis.s 5790 6021 +231 +3.990% cmd/vendor/golang.org/x/tools/go/analysis/passes/internal/analysisutil.s 2246 2519 +273 +12.155% cmd/vendor/golang.org/x/tools/go/types/objectpath.s 15720 16601 +881 +5.604% cmd/vendor/golang.org/x/tools/go/ast/inspector.s 4537 5777 +1240 +27.331% cmd/go/internal/modcmd.s 47192 47738 +546 +1.157% cmd/vendor/golang.org/x/tools/go/analysis/internal/analysisflags.s 13575 14348 +773 +5.694% cmd/vendor/github.com/google/pprof/internal/report.s 79257 80089 +832 +1.050% cmd/link/internal/ld.s 553166 554375 +1209 +0.219% cmd/vendor/golang.org/x/tools/go/analysis/passes/asmdecl.s 29123 29957 +834 +2.864% cmd/vendor/golang.org/x/tools/go/analysis/passes/inspect.s 638 818 +180 +28.213% cmd/vendor/golang.org/x/tools/go/analysis/internal/facts.s 12934 13735 +801 +6.193% cmd/vendor/golang.org/x/tools/go/analysis/passes/buildtag.s 6903 7148 +245 +3.549% cmd/vendor/golang.org/x/tools/go/analysis/passes/cgocall.s 7953 8549 +596 +7.494% cmd/go/internal/work.s 271866 275488 +3622 +1.332% cmd/trace.s 98068 98671 +603 +0.615% cmd/vendor/github.com/google/pprof/internal/driver.s 145066 145844 +778 +0.536% cmd/link/internal/amd64.s 15589 15625 +36 +0.231% cmd/link/internal/arm.s 16490 16541 +51 +0.309% cmd/link/internal/arm64.s 31835 31684 -151 -0.474% cmd/go/internal/envcmd.s 21012 20787 -225 -1.071% cmd/go/internal/clean.s 9306 9233 -73 -0.784% cmd/go/internal/fix.s 1906 2086 +180 +9.444% cmd/go/internal/generate.s 10509 10758 +249 +2.369% cmd/go/internal/get.s 13782 14075 +293 +2.126% cmd/go/internal/run.s 4852 4914 +62 +1.278% cmd/go/internal/list.s 19576 19097 -479 -2.447% cmd/go/internal/bug.s 6253 5720 -533 -8.524% cmd/go/internal/modget.s 58449 59583 +1134 +1.940% cmd/go/internal/vet.s 7384 7228 -156 -2.113% cmd/go/internal/test.s 59654 60193 +539 +0.904% cmd/link/internal/riscv64.s 9856 9931 +75 +0.761% cmd/link/internal/ppc64.s 28471 27046 -1425 -5.005% cmd/link/internal/s390x.s 15081 15524 +443 +2.937% cmd/link/internal/wasm.s 16770 16817 +47 +0.280% cmd/link/internal/x86.s 14008 14093 +85 +0.607% cmd/vendor/github.com/google/pprof/driver.s 8046 8124 +78 +0.969% cmd/vendor/golang.org/x/tools/go/analysis/passes/assign.s 2010 2193 +183 +9.104% cmd/vendor/golang.org/x/tools/go/analysis/passes/atomic.s 2132 2335 +203 +9.522% cmd/go.s 6341 6546 +205 +3.233% cmd/vendor/golang.org/x/tools/go/analysis/passes/bools.s 6078 6348 +270 +4.442% cmd/vendor/golang.org/x/tools/go/analysis/passes/composite.s 4457 4789 +332 +7.449% cmd/vendor/golang.org/x/tools/go/analysis/passes/copylock.s 8814 9375 +561 +6.365% cmd/link.s 3829 4373 +544 +14.207% cmd/vendor/golang.org/x/tools/go/analysis/passes/framepointer.s 2007 2265 +258 +12.855% cmd/pprof.s 9881 10052 +171 +1.731% cmd/vendor/golang.org/x/tools/go/cfg.s 26215 27546 +1331 +5.077% cmd/vendor/golang.org/x/tools/go/analysis/passes/httpresponse.s 3500 4205 +705 +20.143% cmd/vendor/golang.org/x/tools/go/analysis/passes/ifaceassert.s 4790 5407 +617 +12.881% cmd/vendor/golang.org/x/tools/go/ast/astutil.s 50786 55269 +4483 +8.827% cmd/vendor/golang.org/x/tools/go/analysis/passes/nilfunc.s 1754 2033 +279 +15.906% cmd/vendor/golang.org/x/tools/go/analysis/passes/shift.s 4514 5262 +748 +16.571% cmd/vendor/golang.org/x/tools/go/analysis/passes/sigchanyzer.s 3455 3687 +232 +6.715% cmd/vendor/golang.org/x/tools/go/analysis/passes/stdmethods.s 8064 8249 +185 +2.294% cmd/vendor/golang.org/x/tools/go/analysis/passes/stringintconv.s 4547 4900 +353 +7.763% cmd/vendor/golang.org/x/tools/go/analysis/passes/structtag.s 6975 7584 +609 +8.731% cmd/vendor/golang.org/x/tools/go/analysis/passes/testinggoroutine.s 3375 3670 +295 +8.741% cmd/vendor/golang.org/x/tools/go/types/typeutil.s 12924 13870 +946 +7.320% cmd/vendor/golang.org/x/tools/go/analysis/passes/unsafeptr.s 3251 3557 +306 +9.412% cmd/vendor/golang.org/x/tools/go/analysis/passes/unreachable.s 6121 7575 +1454 +23.754% cmd/vendor/golang.org/x/tools/go/analysis/passes/tests.s 13925 14409 +484 +3.476% cmd/vendor/golang.org/x/tools/go/analysis/passes/unusedresult.s 2953 3159 +206 +6.976% cmd/vendor/golang.org/x/tools/go/analysis/unitchecker.s 11563 11962 +399 +3.451% cmd/vendor/golang.org/x/tools/go/analysis/passes/errorsas.s 1735 1933 +198 +11.412% cmd/vendor/golang.org/x/tools/go/analysis/passes/ctrlflow.s 4241 4486 +245 +5.777% cmd/vendor/golang.org/x/tools/go/analysis/passes/loopclosure.s 3107 3460 +353 +11.361% cmd/vendor/golang.org/x/tools/go/analysis/passes/unmarshal.s 1879 2141 +262 +13.944% cmd/vendor/golang.org/x/tools/go/analysis/passes/printf.s 28740 29317 +577 +2.008% cmd/vendor/golang.org/x/tools/go/analysis/passes/lostcancel.s 7188 7930 +742 +10.323% cmd/vet.s 1374 1554 +180 +13.100% cmd/compile/internal/ssa.s 3631074 3571680 -59394 -1.636% cmd/compile/internal/liveness.s 40423 40726 +303 +0.750% cmd/compile/internal/ssagen.s 361816 362743 +927 +0.256% cmd/compile/internal/mips64.s 16298 16330 +32 +0.196% cmd/compile/internal/loong64.s 17376 17440 +64 +0.368% cmd/compile/internal/mips.s 16121 16153 +32 +0.198% cmd/compile/internal/arm64.s 29294 29346 +52 +0.178% cmd/compile/internal/arm.s 26850 26882 +32 +0.119% cmd/compile/internal/amd64.s 30945 31034 +89 +0.288% cmd/compile/internal/dwarfgen.s 34464 35065 +601 +1.744% cmd/compile/internal/ppc64.s 31621 31733 +112 +0.354% cmd/compile/internal/wasm.s 11851 11889 +38 +0.321% cmd/compile/internal/s390x.s 24168 24183 +15 +0.062% cmd/compile/internal/x86.s 18090 18079 -11 -0.061% cmd/compile/internal/walk.s 295003 295945 +942 +0.319% cmd/compile/internal/noder.s 405458 403775 -1683 -0.415% cmd/compile/internal/pkginit.s 30757 31951 +1194 +3.882% cmd/compile/internal/gc.s 18788 18880 +92 +0.490% total 20334984 20041049 -293935 -1.445% package runtime/race/internal/amd64v3 was deleted package runtime/race/internal/amd64v1 was deleted Change-Id: Ibcd71480da1b53cfec4fa16c20f222b9a195e6da Reviewed-on: https://go-review.googlesource.com/c/go/+/431797 Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Jakub Ciolek <jakub@ciolek.dev> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-11-10cmd/compile: add ability to hash-debug on file:line, including inliningDavid Chase
Modified the fmahash gc debug flag to use this, and modified the test to check for a hash match that includes inlining. Also made the test non-short to ensure portability. Note fma.go has been enhanced into an FMA test that requires two separate FMAs in order to "fail"; if either one is 2-rounding, then it "passes". (It neither passes nor fails here; its role is to demonstrate that the FMAs are correctly reported; the enhanced failure mode was discovered while testing the search tool.) Change-Id: I4e328e3654f442d498eac982135420abb59c5434 Reviewed-on: https://go-review.googlesource.com/c/go/+/448358 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: David Chase <drchase@google.com>
2022-11-09all: add missing copyright headercui fliter
Change-Id: Ia5a090953d324f0f8aa9c1808c88125ad5eb6f98 Reviewed-on: https://go-review.googlesource.com/c/go/+/448955 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Bryan Mills <bcmills@google.com> Reviewed-by: Michael Knyszek <mknyszek@google.com> Run-TryBot: Bryan Mills <bcmills@google.com>
2022-11-09cmd/compile: enable brachelim pass on loong64Wayne Zuo
Change-Id: I4fd1c307901c265ab9865bf8a74460ddc15e5d14 Reviewed-on: https://go-review.googlesource.com/c/go/+/416735 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: xiaodong liu <teaofmoli@gmail.com> Auto-Submit: Wayne Zuo <wdvxdr@golangcn.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
2022-11-03cmd/compile/internal/ssa: re-adjust CarryChainTail scheduling priorityPaul E. Murphy
This needs to be as low as possible while not breaking priority assumptions of other scores to correctly schedule carry chains. Prior to the arm64 changes, it was set below ReadTuple. At the time, this prevented the MulHiLo implementation on PPC64 from occluding the scheduling of a full carry chain. Memory scores can also prevent better scheduling, as can be observed with crypto/internal/edwards25519/field.feMulGeneric. Fixes #56497 Change-Id: Ia4b54e6dffcce584faf46b1b8d7cea18a3913887 Reviewed-on: https://go-review.googlesource.com/c/go/+/447435 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: Keith Randall <khr@google.com> Run-TryBot: Paul Murphy <murp@ibm.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2022-11-03cmd/compile: add debug-hash flag for fused-multiply-addDavid Chase
This adds a -d debug flag "fmahash" for hashcode search for floating point architecture-dependent problems. This variable has no effect on architectures w/o fused-multiply-add. This was rebased onto the GOSSAHASH renovation so that this could have its own dedicated environment variable, and so that it would be cheap (a nil check) to check it in the normal case. Includes a basic test of the trigger plumbing. Sample use (on arm64, ppc64le, s390x): % GOCOMPILEDEBUG=fmahash=001110110 \ go build -o foo cmd/compile/internal/ssa/testdata/fma.go fmahash triggered main.main:24 101111101101111001110110 GOFMAHASH triggered main.main:20 010111010000101110111011 1.0000000000000002 1.0000000000000004 -2.220446049250313e-16 exit status 1 The intended use is in conjunction with github.com/dr2chase/gossahash, which will probably acquire a flag "-fma" to streamline its use. This tool+use was inspired by an ad hoc use of this technique "in anger" to debug this very problem. This is also a dry-run for using this same technique to identify code sensitive to loop variable lifetime/capture, should we make that change. Example intended use, with current search tool (using old environment variable), for a test example: gossahash -e GOFMAHASH GOMAGIC=GOFMAHASH go run fma.go Trying go args=[...], env=[GOFMAHASH=1 GOMAGIC=GOFMAHASH] go failed (81 distinct triggers): exit status 1 Trying go args=[...], env=[GOFMAHASH=11 GOMAGIC=GOFMAHASH] go failed (39 distinct triggers): exit status 1 Trying go args=[...], env=[GOFMAHASH=011 GOMAGIC=GOFMAHASH] go failed (18 distinct triggers): exit status 1 Trying go args=[...], env=[GOFMAHASH=0011 GOMAGIC=GOFMAHASH] Trying go args=[...], env=[GOFMAHASH=1011 GOMAGIC=GOFMAHASH] ... Trying go args=[...], env=[GOFMAHASH=0110111011 GOMAGIC=GOFMAHASH] Trying go args=[...], env=[GOFMAHASH=1110111011 GOMAGIC=GOFMAHASH] go failed (2 distinct triggers): exit status 1 Trigger string is 'GOFMAHASH triggered math.qzero:427 111111101010011110111011', repeated 6 times Trigger string is 'GOFMAHASH triggered main.main:20 010111010000101110111011', repeated 1 times Trying go args=[...], env=[GOFMAHASH=01110111011 GOMAGIC=GOFMAHASH] go failed (1 distinct triggers): exit status 1 Trigger string is 'GOFMAHASH triggered main.main:20 010111010000101110111011', repeated 1 times Review GSHS_LAST_FAIL.0.log for failing run FINISHED, suggest this command line for debugging: GOSSAFUNC='main.main:20 010111010000101110111011' \ GOFMAHASH=01110111011 GOMAGIC=GOFMAHASH go run fma.go Change-Id: Ifa22dd8f1c37c18fc8a4f7c396345a364bc367d5 Reviewed-on: https://go-review.googlesource.com/c/go/+/394754 TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: David Chase <drchase@google.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
2022-11-03cmd/compile: remove issueSpillliu-xuewen
Remove the useless issueSpill and continue directly. Change-Id: I085e566be6f7200235e1bfe1f56a8e959316386a GitHub-Last-Rev: 84db90cf34b135f9830d03effc3faa685fd8626e GitHub-Pull-Request: golang/go#56520 Reviewed-on: https://go-review.googlesource.com/c/go/+/447195 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Bryan Mills <bcmills@google.com> Auto-Submit: Keith Randall <khr@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org>
2022-11-02cmd/compile: renovate GOSSAHASHDavid Chase
Randomized feature enable/disable might be something we use to help users debug any problems with changed loop variable capture, and there's another CL that would like to use it to help in locating places where "fused" multiply add instructions change program behavior. This CL: - adds the ability to include an integer parameter (e.g. line number) - replumbed the environment variable into a flag to simplify go build cache management - but added an environment variable to allow flag setting through the environment - which adds the possibility of switching on a different variable (if there's one built-in for variable capture, it shouldn't be GOSSAHASH) - cleaned up the checking code - adds tests for all the intended behavior - removes the case for GSHS_LOGFILE; TBD whether we'll need to put that back or if there is another way. Change-Id: I8503e1bb3dbc4a743aea696e04411ea7ab884787 Reviewed-on: https://go-review.googlesource.com/c/go/+/443063 Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Russ Cox <rsc@golang.org> Run-TryBot: David Chase <drchase@google.com>
2022-10-31cmd/compile: add cache of sizeable objects so they can be reusedKeith Randall
We kind of have this mechanism already, just normalizing it and using it in a bunch of places. Previously a bunch of places cached slices only for the duration of a single function compilation. Now we can reuse slices across a whole compiler run. Use a sync.Pool of powers-of-two sizes. This lets us use not too much memory, and avoid holding onto memory we're no longer using when a GC happens. There's a few different types we need, so generate the code for it. Generics would be useful here, but we can't use generics in the compiler because of bootstrapping. Change-Id: I6cf37e7b7b2e802882aaa723a0b29770511ccd82 Reviewed-on: https://go-review.googlesource.com/c/go/+/444820 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-10-31cmd/compile: separate out sparsemaps that need positionKeith Randall
Make them a separate type, so the normal sparse maps don't need the extra storage. Change-Id: I3a0219487c35ea63723499723b0c742e321d97c4 Reviewed-on: https://go-review.googlesource.com/c/go/+/444819 Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: David Chase <drchase@google.com>
2022-10-31cmd/compile: add rule for post-decomposed growslice optimizationKeith Randall
The recently added rule only works before decomposing slices. Add a rule that works after decomposing slices. The reason we need the latter is because although the length may be a constant, it can be hidden inside a slice that is not constant (its pointer or capacity might be changing). By applying this optimization after decomposing slices, we can find more cases where it applies. Fixes #56440 Change-Id: I0094e59eee3065ab4d210defdda8227a6e897420 Reviewed-on: https://go-review.googlesource.com/c/go/+/446277 Run-TryBot: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Keith Randall <khr@google.com>
2022-10-29cmd/compile: enable address folding for global symbols of shared libraryerifan01
Address folding is disabled in CL42172, the commit message of which said that "In shared library, load/store of global is rewritten to using GOT and temp register, which conflicts with the use of temp register for assembling large offset.". Actually this doesn't happen because the sequence of instructions when rewritten to use Got looks like this: MOVD $sym, Rx becomes MOVD sym@GOT, Rx If there is an offset off, there will be one more instruction: ADD $off, Rx, Rx And MOVD sym, Rx becomes MOVD sym@GOT, REGTMP MOVx (REGTMP), Ry If there is a small offset off, it becomes: MOVD sym@GOT, REGTMP MOVx (REGTMP)off, Ry If off is very large, it becomes: MOVD sym@GOT, REGTMP MOVD $off, Rt ADD Rt, REGTMP MOVx (REGTMP), Ry We can see that the address can be calculated correctly, and testing on darwin/arm64 confirms this. Removing this restriction is beneficial to further optimize the sequence of "ADRP+ADD+LD/ST" to "ADRP+LD/ST(offset), so this CL removes it. Change-Id: I0e9f7bc1723e0a027f32cf0ae2c41cd6df49defe Reviewed-on: https://go-review.googlesource.com/c/go/+/445535 Reviewed-by: Cherry Mui <cherryyz@google.com> Run-TryBot: Eric Fang <eric.fang@arm.com> Reviewed-by: Heschi Kreinick <heschi@google.com> TryBot-Result: Gopher Robot <gobot@golang.org>
2022-10-29cmd/compile: add missing tail calls flag for linux/loong64Guoqi Chen
Set the value of the variable tailCall to true and prevent allocating or clobber the linker register. Change-Id: I4ec19c67056cb99196911aa7c0054be89ab7eb8d Reviewed-on: https://go-review.googlesource.com/c/go/+/414954 Reviewed-by: Cherry Mui <cherryyz@google.com> Reviewed-by: David Chase <drchase@google.com> Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org> Reviewed-by: WANG Xuerui <git@xen0n.name>
2022-10-28cmd/compile: emit DIEs for zero sized variablesAlessandro Arzilli
Fixes the compiler to emit DIEs for zero sized variables. Fixes #54615 Change-Id: I1e0c86a97f1abcc7edae516b6a7fe35bcb65ed0f Reviewed-on: https://go-review.googlesource.com/c/go/+/433479 Reviewed-by: Damien Neil <dneil@google.com> TryBot-Result: Gopher Robot <gobot@golang.org> Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com> Reviewed-by: Than McIntosh <thanm@google.com>