]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/prove.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / prove.go
index cf225ff38e58f5e231e3e3de3862712cfec309c3..1aea2822912c2726625b247d531a4dd52dd550a2 100644 (file)
@@ -1,7 +1,6 @@
 // errorcheck -0 -d=ssa/prove/debug=1
 
 //go:build amd64
-// +build amd64
 
 // Copyright 2016 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
@@ -820,7 +819,7 @@ func unrollDownExcl0(a []int) int {
 // Induction variable in unrolled loop.
 func unrollDownExcl1(a []int) int {
        var i, x int
-       for i = len(a) - 1; i >= 1; i -= 2 { // ERROR "Induction variable: limits \[1,\?\], increment 2$"
+       for i = len(a) - 1; i >= 1; i -= 2 { // ERROR "Induction variable: limits \(0,\?\], increment 2$"
                x += a[i]   // ERROR "Proved IsInBounds$"
                x += a[i-1] // ERROR "Proved IsInBounds$"
        }
@@ -1038,6 +1037,25 @@ func divShiftClean32(n int32) int32 {
        return n / int32(16) // ERROR "Proved Rsh32x64 shifts to zero"
 }
 
+// Bounds check elimination
+
+func sliceBCE1(p []string, h uint) string {
+       if len(p) == 0 {
+               return ""
+       }
+
+       i := h & uint(len(p)-1)
+       return p[i] // ERROR "Proved IsInBounds$"
+}
+
+func sliceBCE2(p []string, h int) string {
+       if len(p) == 0 {
+               return ""
+       }
+       i := h & (len(p) - 1)
+       return p[i] // ERROR "Proved IsInBounds$"
+}
+
 func and(p []byte) ([]byte, []byte) { // issue #52563
        const blocksize = 16
        fullBlocks := len(p) &^ (blocksize - 1)
@@ -1092,6 +1110,11 @@ func issue51622(b []byte) int {
        return 0
 }
 
+func issue45928(x int) {
+       combinedFrac := x / (x | (1 << 31)) // ERROR "Proved Neq64$"
+       useInt(combinedFrac)
+}
+
 //go:noinline
 func useInt(a int) {
 }