]> Cypherpunks repositories - gostls13.git/commit
cmd/6g: avoid taking the address of slices unnecessarily.
authorRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 7 Sep 2012 04:54:42 +0000 (06:54 +0200)
committerRémy Oudompheng <oudomphe@phare.normalesup.org>
Fri, 7 Sep 2012 04:54:42 +0000 (06:54 +0200)
commitacbe6c94d710932706fb67d6caaa6dbe6cbd4dad
tree8b4b32c57c4df6991dc2c032b5529cd6d5b4a902
parent212ce41d004cc9e33d35b64cc13c2c9baf843452
cmd/6g: avoid taking the address of slices unnecessarily.

The main case where it happens is when evaluating &s[i] without
bounds checking, which usually happens during range loops (i=0).

This allows registerization of the corresponding variables,
saving 16 bytes of stack frame for each such range loop and a
LEAQ instruction.

R=golang-dev, rsc, dave
CC=golang-dev, remy
https://golang.org/cl/6497073
src/cmd/6g/cgen.c