1
0
mirror of https://github.com/golang/go synced 2024-11-13 18:30:26 -07:00

cmd/gc: get rid of redundant slice bound check.

For normal slices a[i:j] we're generating 3 bounds
checks: j<={len(string),cap(slice)}, j<=j (!), and i<=j.
Somehow snuck in as part of the [i:j:k] implementation
where the second check does something.
Remove the second check when we don't need it.

R=rsc, r
CC=golang-dev
https://golang.org/cl/12311046
This commit is contained in:
Keith Randall 2013-08-05 13:24:33 -07:00
parent 49da9a8e44
commit 19e2922688

View File

@ -2623,7 +2623,7 @@ sliceany(Node* n, NodeList **init)
cb = n->right->right->right;
} else {
hb = n->right->right;
cb = hb;
cb = N;
}
bounded = n->etype;