aboutsummaryrefslogtreecommitdiff
path: root/test/phiopt.go
diff options
context:
space:
mode:
authorGerrit Code Review <noreply-gerritcodereview@google.com>2016-03-01 21:36:45 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-03-01 21:36:45 +0000
commita6fb2aede7c8d47b4d913eb83fa45bbeca76c433 (patch)
tree1dd5039e5515959a8d162fbdac964663dd2ec778 /test/phiopt.go
parent998aaf8a64b7d90269815a2ae9d778da519d0a87 (diff)
parent9d854fd44ae669f60c15133a4d2ce407ea2bccc4 (diff)
downloadgo-a6fb2aede7c8d47b4d913eb83fa45bbeca76c433.tar.xz
Merge "Merge branch 'dev.ssa' into mergebranch"
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() {
+}