]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: get rid of redundant slice bound check.
authorKeith Randall <khr@golang.org>
Mon, 5 Aug 2013 20:24:33 +0000 (13:24 -0700)
committerKeith Randall <khr@golang.org>
Mon, 5 Aug 2013 20:24:33 +0000 (13:24 -0700)
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

src/cmd/gc/walk.c

index 892d73bc6f17e6de0b6b1b742a5fe73c76abc4fa..033b041f3c854617d548134fcfa5d2ba50601acc 100644 (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;