diff options
| author | Paschalis Tsilias <paschalis.tsilias@gmail.com> | 2023-09-13 12:44:17 +0300 |
|---|---|---|
| committer | Gopher Robot <gobot@golang.org> | 2024-09-10 21:20:57 +0000 |
| commit | fe69121bc538260cf91f11dab705335b690e51a3 (patch) | |
| tree | d5962a3404521bd5bed263fad4156d462f6673c6 /test/codegen/strings.go | |
| parent | 3da4281df1b0c7ea11b524ff19fc2f409b8e58c0 (diff) | |
| download | go-fe69121bc538260cf91f11dab705335b690e51a3.tar.xz | |
cmd/compile: optimize []byte(string1 + string2)
This CL optimizes the compilation of string-to-bytes conversion in the
case of string additions.
Fixes #62407
Change-Id: Ic47df758478e5d061880620025c4ec7dbbff8a64
Reviewed-on: https://go-review.googlesource.com/c/go/+/527935
Reviewed-by: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Reviewed-by: Keith Randall <khr@golang.org>
Auto-Submit: Keith Randall <khr@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Tim King <taking@google.com>
Diffstat (limited to 'test/codegen/strings.go')
| -rw-r--r-- | test/codegen/strings.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/codegen/strings.go b/test/codegen/strings.go index f98c062d1b..64dcf4c842 100644 --- a/test/codegen/strings.go +++ b/test/codegen/strings.go @@ -26,6 +26,11 @@ func ToByteSlice() []byte { // Issue #24698 return []byte("foo") } +func ConvertToByteSlice(a, b, c string) []byte { + // amd64:`.*runtime.concatbyte3` + return []byte(a + b + c) +} + // Loading from read-only symbols should get transformed into constants. func ConstantLoad() { // 12592 = 0x3130 |
