]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: reverse order of slice bounds checks
authorKeith Randall <keithr@alum.mit.edu>
Fri, 8 Mar 2019 23:01:32 +0000 (15:01 -0800)
committerKeith Randall <khr@golang.org>
Sat, 9 Mar 2019 00:52:45 +0000 (00:52 +0000)
commit83a33d3855e257b383b2a3a10dfd9748ad17cfb4
treebbb02b368504c00b5dc20a2d960ff05cb3fb5734
parent3cf89e509b21d0f469c4e0a78179b9d2d961c864
cmd/compile: reverse order of slice bounds checks

Turns out this makes the fix for 28797 unnecessary, because this order
ensures that the RHS of IsSliceInBounds ops are always nonnegative.

The real reason for this change is that it also makes dealing with
<0 values easier for reporting values in bounds check panics (issue #30116).

Makes cmd/go negligibly smaller.

Update #28797

Change-Id: I1f25ba6d2b3b3d4a72df3105828aa0a4b629ce85
Reviewed-on: https://go-review.googlesource.com/c/go/+/166377
Run-TryBot: Keith Randall <khr@golang.org>
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
src/cmd/compile/internal/gc/ssa.go
test/loopbce.go
test/prove.go