diff options
| author | Cuong Manh Le <cuong.manhle.vn@gmail.com> | 2019-09-28 23:30:08 +0700 |
|---|---|---|
| committer | Keith Randall <khr@golang.org> | 2019-10-08 06:09:26 +0000 |
| commit | 77f5adba554c80dc536f3076b2fa882d2cf0e992 (patch) | |
| tree | e9752bd4f90ba6570c0db6d88b1808da83a11aae /test/codegen | |
| parent | ecba83520d4c34870e0f5f0997d59d4496957240 (diff) | |
| download | go-77f5adba554c80dc536f3076b2fa882d2cf0e992.tar.xz | |
cmd/compile: don't use statictmps for small object in slice literal
Fixes #21561
Change-Id: I89c59752060dd9570d17d73acbbaceaefce5d8ce
Reviewed-on: https://go-review.googlesource.com/c/go/+/197560
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/slices.go | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/codegen/slices.go b/test/codegen/slices.go index fccd711d71..cf569e27fb 100644 --- a/test/codegen/slices.go +++ b/test/codegen/slices.go @@ -113,3 +113,54 @@ func SliceNilCheck(s []int) { // amd64:-`TESTB` _ = *p } + +// ---------------------- // +// Init slice literal // +// ---------------------- // +// See issue 21561 +func InitSmallSliceLiteral() []int { + // amd64:`MOVQ\t[$]42` + return []int{42} +} + +func InitNotSmallSliceLiteral() []int { + // amd64:`MOVQ\t.*autotmp_` + return []int{ + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + 42, + } +} |
