1 // Copyright 2016 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package ssa 6 7 // checkbce prints all bounds checks that are present in the function. 8 // Useful to find regressions. checkbce is only activated when with 9 // corresponding debug options, so it's off by default. 10 // See test/checkbce.go 11 func checkbce(f *Func) { 12 if f.pass.debug <= 0 { 13 return 14 } 15 16 for _, b := range f.Blocks { 17 for _, v := range b.Values { 18 if v.Op == OpIsInBounds || v.Op == OpIsSliceInBounds { 19 f.Config.Warnl(v.Line, "Found %v", v.Op) 20 } 21 } 22 } 23 } 24