1
0
mirror of https://github.com/golang/go synced 2024-09-30 05:24:29 -06:00

cmd/compile: respect Node.Bounded when inserting OpArraySelect

This triggers 119 times during make.bash.

This CL reduces the time it takes for the
compiler to panic while compiling the code in #19751 
from 22 minutes to 15 minutes. Yay, I guess.

Updates #19751 

Change-Id: I8ca7f1ae75f89d1eb2a361d67b3055a975221734
Reviewed-on: https://go-review.googlesource.com/39294
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
This commit is contained in:
Josh Bleecher Snyder 2017-04-03 10:00:02 -07:00
parent 9d5987d79f
commit 7439ba32ff

View File

@ -1965,7 +1965,9 @@ func (s *state) expr(n *Node) *ssa.Value {
return s.newValue0(ssa.OpUnknown, n.Type)
}
i = s.extendIndex(i, panicindex)
s.boundsCheck(i, s.constInt(Types[TINT], bound))
if !n.Bounded() {
s.boundsCheck(i, s.constInt(Types[TINT], bound))
}
return s.newValue1I(ssa.OpArraySelect, n.Type, 0, a)
}
p := s.addr(n, false)