1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:08:33 -06:00

go.tools/go/ssa: add Max to Slice's SSA operand list

LGTM=adonovan
R=adonovan, bradfitz
CC=golang-codereviews
https://golang.org/cl/101160043
This commit is contained in:
Peter Collingbourne 2014-06-11 16:16:19 -04:00 committed by Alan Donovan
parent cc02c5be36
commit cd36f52558
2 changed files with 8 additions and 1 deletions

View File

@ -635,6 +635,13 @@ func init() {
if got := lenCapLoHi(s[1:3:3]); got != [4]int{2, 2, 1, 2} { if got := lenCapLoHi(s[1:3:3]); got != [4]int{2, 2, 1, 2} {
panic(got) panic(got)
} }
max := 3
if v[2] == 42 {
max = 2
}
if got := lenCapLoHi(s[1:2:max]); got != [4]int{1, 1, 1, 1} {
panic(got)
}
} }
// Regression test for issue 7840 (covered by SSA sanity checker). // Regression test for issue 7840 (covered by SSA sanity checker).

View File

@ -1655,7 +1655,7 @@ func (s *Send) Operands(rands []*Value) []*Value {
} }
func (v *Slice) Operands(rands []*Value) []*Value { func (v *Slice) Operands(rands []*Value) []*Value {
return append(rands, &v.X, &v.Low, &v.High) return append(rands, &v.X, &v.Low, &v.High, &v.Max)
} }
func (s *Store) Operands(rands []*Value) []*Value { func (s *Store) Operands(rands []*Value) []*Value {