]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: respect Node.Bounded when inserting OpArraySelect
authorJosh Bleecher Snyder <josharian@gmail.com>
Mon, 3 Apr 2017 17:00:02 +0000 (10:00 -0700)
committerJosh Bleecher Snyder <josharian@gmail.com>
Mon, 3 Apr 2017 17:31:08 +0000 (17:31 +0000)
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>
src/cmd/compile/internal/gc/ssa.go

index c21422ac6504f416ab8989f7d5e025d22c48f5ec..ad81858186defd2b11e6100ef0caaa34ea50af0c 100644 (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)