[RFC PATCH 47/48] mem2reg: add some small test cases

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

 



---
 validation/mem2reg/global-direct00.c    | 24 ++++++++++++++++++++++++
 validation/mem2reg/local-addr-taken00.c | 21 +++++++++++++++++++++
 validation/mem2reg/local-direct00.c     | 20 ++++++++++++++++++++
 3 files changed, 65 insertions(+)
 create mode 100644 validation/mem2reg/global-direct00.c
 create mode 100644 validation/mem2reg/local-addr-taken00.c
 create mode 100644 validation/mem2reg/local-direct00.c

diff --git a/validation/mem2reg/global-direct00.c b/validation/mem2reg/global-direct00.c
new file mode 100644
index 000000000..cd0f0d1a0
--- /dev/null
+++ b/validation/mem2reg/global-direct00.c
@@ -0,0 +1,24 @@
+int a, c, d;
+
+int foo(void)
+{
+	int b, e;
+	if (a)
+		b = c;
+	else
+		b = d;
+	if (c)
+		a = b;
+	if (b)
+		e = a;
+	return e;
+}
+
+/*
+ * check-name: mem2reg global direct 00
+ * check-command: test-linearize -fdump-ir=mem2reg,only -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-pattern-4-times: load\\.
+ * check-output-pattern-1-times: store\\.
+ */
diff --git a/validation/mem2reg/local-addr-taken00.c b/validation/mem2reg/local-addr-taken00.c
new file mode 100644
index 000000000..bcfa32257
--- /dev/null
+++ b/validation/mem2reg/local-addr-taken00.c
@@ -0,0 +1,21 @@
+int foo(int c, int a, int b)
+{
+	int l;
+	int *p = &l;
+
+	if (c)
+		l = a;
+	else
+		l = b;
+
+	return l;
+}
+
+/*
+ * check-name: mem2reg local address taken 00
+ * check-command: test-linearize -fdump-ir=mem2reg,only -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-excludes: load\\.
+ * check-output-excludes: store\\.
+ */
diff --git a/validation/mem2reg/local-direct00.c b/validation/mem2reg/local-direct00.c
new file mode 100644
index 000000000..fc55fa076
--- /dev/null
+++ b/validation/mem2reg/local-direct00.c
@@ -0,0 +1,20 @@
+int foo(int c, int a, int b)
+{
+	int l;
+
+	if (c)
+		l = a;
+	else
+		l = b;
+
+	return l;
+}
+
+/*
+ * check-name: mem2reg local direct 00
+ * check-command: test-linearize -fdump-ir=mem2reg,only -Wno-decl $file
+ * check-output-ignore
+ *
+ * check-output-excludes: load\\.
+ * check-output-excludes: store\\.
+ */
-- 
2.14.0

--
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