[PATCH 1/8] optim: add some more tests

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

 



Add some tests showing missed optimization opportunities.

Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/optim/dup-cond0.c | 20 ++++++++++++++++++++
 validation/optim/phi-ret.c   | 22 ++++++++++++++++++++++
 2 files changed, 42 insertions(+)
 create mode 100644 validation/optim/dup-cond0.c
 create mode 100644 validation/optim/phi-ret.c

diff --git a/validation/optim/dup-cond0.c b/validation/optim/dup-cond0.c
new file mode 100644
index 000000000..dc4991cb0
--- /dev/null
+++ b/validation/optim/dup-cond0.c
@@ -0,0 +1,20 @@
+struct s {
+	int f;
+};
+
+static int foo(struct s *s)
+{
+	if (s->f)
+		return 0;
+	else if (!s->f)
+		return 4;
+}
+
+/*
+ * check-name: dup-cond0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-contains: select
+ */
diff --git a/validation/optim/phi-ret.c b/validation/optim/phi-ret.c
new file mode 100644
index 000000000..204366a90
--- /dev/null
+++ b/validation/optim/phi-ret.c
@@ -0,0 +1,22 @@
+int foo(int p, int q, int v)
+{
+	if (q) {
+		if (p) {
+			v = p;
+			p = 0;
+		}
+	} else
+		p = 0;
+	if (p)
+		return v + 1;
+	return q;
+}
+
+/*
+ * check-name: phi-ret
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: phi\\.
+ */
-- 
2.16.2

--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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