diff options
| author | Iskander Sharipov <iskander.sharipov@intel.com> | 2018-09-17 21:37:30 +0300 |
|---|---|---|
| committer | Iskander Sharipov <iskander.sharipov@intel.com> | 2018-09-19 12:03:58 +0000 |
| commit | c03d0e4fec6b02c09d286dae5df2f63164d74ea1 (patch) | |
| tree | a6f08a7995895a53ac83e046b4506711cfae5891 /test/codegen | |
| parent | 9850ad045fced1346a049df4baec7d4b7ab0db8c (diff) | |
| download | go-c03d0e4fec6b02c09d286dae5df2f63164d74ea1.tar.xz | |
cmd/compile/internal/gc: handle arith ops in samesafeexpr
Teach samesafeexpr to handle arithmetic unary and binary ops.
It makes map lookup optimization possible in
m[k+1] = append(m[k+1], ...)
m[-k] = append(m[-k], ...)
... etc
Does not cover "+" for strings (concatenation).
Change-Id: Ibbb16ac3faf176958da344be1471b06d7cf33a6c
Reviewed-on: https://go-review.googlesource.com/135795
Run-TryBot: Iskander Sharipov <iskander.sharipov@intel.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'test/codegen')
| -rw-r--r-- | test/codegen/mapaccess.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/codegen/mapaccess.go b/test/codegen/mapaccess.go index 35620e741c..a914a0c766 100644 --- a/test/codegen/mapaccess.go +++ b/test/codegen/mapaccess.go @@ -304,6 +304,18 @@ func mapAppendAssignmentInt32() { // arm64:-".*mapaccess" m[k] = append(m[k], a...) + // 386:-".*mapaccess" + // amd64:-".*mapaccess" + // arm:-".*mapaccess" + // arm64:-".*mapaccess" + m[k+1] = append(m[k+1], a...) + + // 386:-".*mapaccess" + // amd64:-".*mapaccess" + // arm:-".*mapaccess" + // arm64:-".*mapaccess" + m[-k] = append(m[-k], a...) + // Exceptions // 386:".*mapaccess" @@ -349,6 +361,18 @@ func mapAppendAssignmentInt64() { // arm64:-".*mapaccess" m[k] = append(m[k], a...) + // 386:-".*mapaccess" + // amd64:-".*mapaccess" + // arm:-".*mapaccess" + // arm64:-".*mapaccess" + m[k+1] = append(m[k+1], a...) + + // 386:-".*mapaccess" + // amd64:-".*mapaccess" + // arm:-".*mapaccess" + // arm64:-".*mapaccess" + m[-k] = append(m[-k], a...) + // Exceptions // 386:".*mapaccess" |
