From: Keith Randall Date: Mon, 5 Aug 2013 20:24:33 +0000 (-0700) Subject: cmd/gc: get rid of redundant slice bound check. X-Git-Tag: go1.2rc2~781 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=19e292268896c245c781e711ae3fff5ff5e127e5;p=gostls13.git 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 --- diff --git a/src/cmd/gc/walk.c b/src/cmd/gc/walk.c index 892d73bc6f..033b041f3c 100644 --- a/src/cmd/gc/walk.c +++ b/src/cmd/gc/walk.c @@ -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;