[PATCH 1/4] add testcases for wrong ordering in phi-nodes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In valid SSA there is a 1-to-1 correspondance between
each operand of a phi-node and the parents BB.
However, currently, this is not always respected.

Add testcases for the known problems.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/linear/phi-order01.c | 17 +++++++++++++++++
 validation/linear/phi-order02.c | 17 +++++++++++++++++
 validation/linear/phi-order03.c |  9 +++++++++
 validation/linear/phi-order04.c | 12 ++++++++++++
 4 files changed, 55 insertions(+)
 create mode 100644 validation/linear/phi-order01.c
 create mode 100644 validation/linear/phi-order02.c
 create mode 100644 validation/linear/phi-order03.c
 create mode 100644 validation/linear/phi-order04.c

diff --git a/validation/linear/phi-order01.c b/validation/linear/phi-order01.c
new file mode 100644
index 000000000..18f2acbce
--- /dev/null
+++ b/validation/linear/phi-order01.c
@@ -0,0 +1,17 @@
+int fun(void);
+
+static int foo(int a)
+{
+	return a && fun();
+}
+
+static int bar(int a)
+{
+	return a || fun();
+}
+
+/*
+ * check-name: phi-order01
+ * check-command: sparse -vir -flinearize=last $file
+ * check-known-to-fail
+ */
diff --git a/validation/linear/phi-order02.c b/validation/linear/phi-order02.c
new file mode 100644
index 000000000..5dd4b38ee
--- /dev/null
+++ b/validation/linear/phi-order02.c
@@ -0,0 +1,17 @@
+int fun(void);
+
+static int foo(int a) { return 0 || fun(); }
+static int bar(int a) { return 1 || fun(); }
+static int baz(int a) { return 0 && fun(); }
+static int qux(int a) { return 1 && fun(); }
+
+static int oof(int a) { return fun() || 1; }
+static int rab(int a) { return fun() || 0; }
+static int zab(int a) { return fun() && 1; }
+static int xuq(int a) { return fun() && 0; }
+
+/*
+ * check-name: phi-order02
+ * check-command: sparse -vir -flinearize=last $file
+ * check-known-to-fail
+ */
diff --git a/validation/linear/phi-order03.c b/validation/linear/phi-order03.c
new file mode 100644
index 000000000..316cfeebd
--- /dev/null
+++ b/validation/linear/phi-order03.c
@@ -0,0 +1,9 @@
+int fun(void);
+
+static int foo(void) { return ((0 || fun()) && fun()); }
+
+/*
+ * check-name: phi-order03
+ * check-command: sparse -vir -flinearize=last $file
+ * check-known-to-fail
+ */
diff --git a/validation/linear/phi-order04.c b/validation/linear/phi-order04.c
new file mode 100644
index 000000000..4bbed6ec5
--- /dev/null
+++ b/validation/linear/phi-order04.c
@@ -0,0 +1,12 @@
+static void foo(int *b)
+{
+	if (1) {
+		int c;
+		b = &c;
+	}
+}
+
+/*
+ * check-name: phi-order04
+ * check-command: sparse -vir -flinear=last $file
+ */
-- 
2.18.0




[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux