]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: remove redundant calls to cmpstring
authorkhr@golang.org <khr@golang.org>
Sun, 14 Apr 2024 02:21:15 +0000 (19:21 -0700)
committerKeith Randall <khr@google.com>
Fri, 19 Apr 2024 16:31:02 +0000 (16:31 +0000)
commit1a0b86375fad202048adb88cba4caec535a52a45
tree3ba0daeb3bbb608d528e895cb14fd3a860520595
parentd428a63875d335d1e1b9a3b3b45ad58f46e1e6bc
cmd/compile: remove redundant calls to cmpstring

The results of cmpstring are reuseable if the second call has the
same arguments and memory.

Note that this gets rid of cmpstring, but we still generate a
redundant </<= test and branch afterwards, because the compiler
doesn't know that cmpstring only ever returns -1,0,1.

Update #61725

Change-Id: I93a0d1ccca50d90b1e1a888240ffb75a3b10b59b
Reviewed-on: https://go-review.googlesource.com/c/go/+/578835
Reviewed-by: David Chase <drchase@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
src/cmd/compile/internal/ssa/_gen/generic.rules
src/cmd/compile/internal/ssa/rewritegeneric.go
src/cmp/cmp.go
test/codegen/comparisons.go