mirror of
https://github.com/golang/go
synced 2024-11-26 02:17:58 -07:00
cmd/gc: Don't calculate second value in range if it is blank.
Low hanging fruit optimization. Will remove an expensive copy if the range variable is an array. R=golang-dev, rsc CC=golang-dev https://golang.org/cl/6564052
This commit is contained in:
parent
cca48f1a57
commit
7936ab58f7
@ -71,6 +71,11 @@ typecheckrange(Node *n)
|
||||
v2 = N;
|
||||
if(n->list->next)
|
||||
v2 = n->list->next->n;
|
||||
|
||||
if(isblank(v2)) {
|
||||
n->list = list1(v1);
|
||||
v2 = N;
|
||||
}
|
||||
|
||||
if(v1->defn == n)
|
||||
v1->type = t1;
|
||||
|
Loading…
Reference in New Issue
Block a user