Phi example
authorMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 7 Feb 2007 17:04:17 +0000 (17:04 +0000)
committerMichael Beck <beck@ipd.info.uni-karlsruhe.de>
Wed, 7 Feb 2007 17:04:17 +0000 (17:04 +0000)
ir/be/test/phi_bad.c [new file with mode: 0644]

diff --git a/ir/be/test/phi_bad.c b/ir/be/test/phi_bad.c
new file mode 100644 (file)
index 0000000..680acfc
--- /dev/null
@@ -0,0 +1,20 @@
+static int A;
+
+/* This function produces unnecessary Phi nodes due to the way
+ * x is assigned. Note: This is not a bug, its by the Phi construction algorithm. */
+void test(int l, int m) {
+  int i, x = m;
+
+  for (i = 0; i < l; ++i) {
+    A = x;
+
+    if (l > 5)
+      x = m;
+  }
+}
+
+int main()
+{
+  test(4,5);
+  printf("A = %d\n", A);
+}