Commit 7439ba32 authored by Josh Bleecher Snyder's avatar Josh Bleecher Snyder

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: default avatarKeith Randall <khr@golang.org>
parent 9d5987d7
...@@ -1965,7 +1965,9 @@ func (s *state) expr(n *Node) *ssa.Value { ...@@ -1965,7 +1965,9 @@ func (s *state) expr(n *Node) *ssa.Value {
return s.newValue0(ssa.OpUnknown, n.Type) return s.newValue0(ssa.OpUnknown, n.Type)
} }
i = s.extendIndex(i, panicindex) i = s.extendIndex(i, panicindex)
if !n.Bounded() {
s.boundsCheck(i, s.constInt(Types[TINT], bound)) s.boundsCheck(i, s.constInt(Types[TINT], bound))
}
return s.newValue1I(ssa.OpArraySelect, n.Type, 0, a) return s.newValue1I(ssa.OpArraySelect, n.Type, 0, a)
} }
p := s.addr(n, false) p := s.addr(n, false)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment