From 86c04f829c33228586f9fc1f04740bfeb8c0ef87 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Wed, 7 Feb 2007 17:04:17 +0000 Subject: [PATCH] Phi example --- ir/be/test/phi_bad.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 ir/be/test/phi_bad.c diff --git a/ir/be/test/phi_bad.c b/ir/be/test/phi_bad.c new file mode 100644 index 000000000..680acfcf4 --- /dev/null +++ b/ir/be/test/phi_bad.c @@ -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); +} -- 2.20.1