]> Cypherpunks.ru repositories - gostls13.git/blobdiff - test/phiopt.go
cmd/compile/internal/inline: score call sites exposed by inlines
[gostls13.git] / test / phiopt.go
index 21dd13155c3c39cce6699d889371f6f4db6d0cd6..9e21bfdba55aeab33ecf4d943043ff5485164861 100644 (file)
@@ -1,6 +1,7 @@
-// +build amd64
 // errorcheck -0 -d=ssa/phiopt/debug=3
 
+//go:build amd64 || s390x || arm64
+
 // Copyright 2016 The Go Authors. All rights reserved.
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
@@ -104,5 +105,29 @@ func f7and(a bool, b bool) bool {
        return a && b // ERROR "converted OpPhi to AndB$"
 }
 
+//go:noinline
+func f8(s string) (string, bool) {
+       neg := false
+       if s[0] == '-' {    // ERROR "converted OpPhi to Copy$"
+               neg = true
+               s = s[1:]
+       }
+       return s, neg
+}
+
+var d int
+
+//go:noinline
+func f9(a, b int) bool {
+       c := false
+       if a < 0 {          // ERROR "converted OpPhi to Copy$"
+               if b < 0 {
+                       d = d + 1
+               }
+               c = true
+       }
+       return c
+}
+
 func main() {
 }