aboutsummaryrefslogtreecommitdiff
path: root/test/phiopt.go
diff options
context:
space:
mode:
Diffstat (limited to 'test/phiopt.go')
-rw-r--r--test/phiopt.go43
1 files changed, 43 insertions, 0 deletions
diff --git a/test/phiopt.go b/test/phiopt.go
new file mode 100644
index 0000000000..9b9b701124
--- /dev/null
+++ b/test/phiopt.go
@@ -0,0 +1,43 @@
+// +build amd64
+// errorcheck -0 -d=ssa/phiopt/debug=3
+
+package main
+
+func f0(a bool) bool {
+ x := false
+ if a {
+ x = true
+ } else {
+ x = false
+ }
+ return x // ERROR "converted OpPhi to OpCopy$"
+}
+
+func f1(a bool) bool {
+ x := false
+ if a {
+ x = false
+ } else {
+ x = true
+ }
+ return x // ERROR "converted OpPhi to OpNot$"
+}
+
+func f2(a, b int) bool {
+ x := true
+ if a == b {
+ x = false
+ }
+ return x // ERROR "converted OpPhi to OpNot$"
+}
+
+func f3(a, b int) bool {
+ x := false
+ if a == b {
+ x = true
+ }
+ return x // ERROR "converted OpPhi to OpCopy$"
+}
+
+func main() {
+}