]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/gc: handle arith ops in samesafeexpr
authorIskander Sharipov <iskander.sharipov@intel.com>
Mon, 17 Sep 2018 18:37:30 +0000 (21:37 +0300)
committerIskander Sharipov <iskander.sharipov@intel.com>
Wed, 19 Sep 2018 12:03:58 +0000 (12:03 +0000)
commitc03d0e4fec6b02c09d286dae5df2f63164d74ea1
treea6f08a7995895a53ac83e046b4506711cfae5891
parent9850ad045fced1346a049df4baec7d4b7ab0db8c
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>
src/cmd/compile/internal/gc/typecheck.go
test/codegen/mapaccess.go