[PATCH 2/4] testsuite: add a few more tests catching quadratic behaviour

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

 



Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
---
 validation/mem2reg/quadra01.c | 27 +++++++++++++++++++++++++++
 validation/mem2reg/quadra02.c | 18 ++++++++++++++++++
 validation/repeat.h           | 24 ++++++++++++++++++++++++
 3 files changed, 69 insertions(+)
 create mode 100644 validation/mem2reg/quadra01.c
 create mode 100644 validation/mem2reg/quadra02.c
 create mode 100644 validation/repeat.h

diff --git a/validation/mem2reg/quadra01.c b/validation/mem2reg/quadra01.c
new file mode 100644
index 000000000..b71f46969
--- /dev/null
+++ b/validation/mem2reg/quadra01.c
@@ -0,0 +1,27 @@
+#include "repeat.h"
+
+void use(void *, void *, void *, void *);
+void *def(void);
+
+#define BLOCK(n) {				\
+	void *label;				\
+	use(&&w##n, &&x##n, &&y##n, &&z##n);	\
+w##n:	label = def(); goto *label;		\
+x##n:	label = def(); goto *label;		\
+y##n:	label = def(); goto *label;		\
+z##n:	label = def(); goto *label;		\
+}
+
+static void foo(void) {
+	REPEAT2(5, BLOCK)
+}
+
+/*
+ * check-name: quadratic @ liveness
+ * check-command: test-linearize -I. $file
+ * check-timeout:
+ *
+ * check-output-ignore
+ * check-output-excludes: phi\\.
+ * check-output-excludes: phisrc\\.
+ */
diff --git a/validation/mem2reg/quadra02.c b/validation/mem2reg/quadra02.c
new file mode 100644
index 000000000..6475c7802
--- /dev/null
+++ b/validation/mem2reg/quadra02.c
@@ -0,0 +1,18 @@
+#include "repeat.h"
+
+#define	PAT(X)	int a##X = X;
+static void foo(void)
+{
+	REPEAT2(12, PAT)
+}
+
+/*
+ * check-name: quadratic vars
+ * check-command: test-linearize -I. $file
+ * check-timeout:
+ *
+ * check-output-ignore
+ * check-output-excludes: phi\\.
+ * check-output-excludes: phisrc\\.
+ * check-output-excludes: store\\.
+ */
diff --git a/validation/repeat.h b/validation/repeat.h
new file mode 100644
index 000000000..83433b2a2
--- /dev/null
+++ b/validation/repeat.h
@@ -0,0 +1,24 @@
+#define  R0(P, S)  P(S)
+#define  R1(P, S)  R0(P,S##0)  R0(P,S##1)
+#define  R2(P, S)  R0(P,S##0)  R0(P,S##1)  R0(P,S##2)  R0(P,S##3)
+#define  R3(P, S)  R0(P,S##0)  R0(P,S##1)  R0(P,S##2)  R0(P,S##3)  R0(P,S##4)  R0(P,S##5)  R0(P,S##6)  R0(P,S##7)
+#define  R4(P, S)  R3(P,S##0)  R3(P,S##1)
+#define  R5(P, S)  R3(P,S##0)  R3(P,S##1)  R3(P,S##2)  R3(P,S##3)
+#define  R6(P, S)  R3(P,S##0)  R3(P,S##1)  R3(P,S##2)  R3(P,S##3)  R3(P,S##4)  R3(P,S##5)  R3(P,S##6)  R3(P,S##7)
+#define  R7(P, S)  R6(P,S##0)  R6(P,S##1)
+#define  R8(P, S)  R6(P,S##0)  R6(P,S##1)  R6(P,S##2)  R6(P,S##3)
+#define  R9(P, S)  R6(P,S##0)  R6(P,S##1)  R6(P,S##2)  R6(P,S##3)  R6(P,S##4)  R6(P,S##5)  R6(P,S##6)  R6(P,S##7)
+#define R10(P, S)  R9(P,S##0)  R9(P,S##1)
+#define R11(P, S)  R9(P,S##0)  R9(P,S##1)  R9(P,S##2)  R9(P,S##3)
+#define R12(P, S)  R9(P,S##0)  R9(P,S##1)  R9(P,S##2)  R9(P,S##3)  R9(P,S##4)  R9(P,S##5)  R9(P,S##6)  R9(P,S##7)
+#define R13(P, S) R12(P,S##0) R12(P,S##1)
+#define R14(P, S) R12(P,S##0) R12(P,S##1) R12(P,S##2) R12(P,S##3)
+#define R15(P, S) R12(P,S##0) R12(P,S##1) R12(P,S##2) R12(P,S##3) R12(P,S##4) R12(P,S##5) R12(P,S##6) R12(P,S##7)
+#define R16(P, S) R15(P,S##0) R15(P,S##1)
+#define R17(P, S) R15(P,S##0) R15(P,S##1) R15(P,S##2) R15(P,S##3)
+#define R18(P, S) R15(P,S##0) R15(P,S##1) R15(P,S##2) R15(P,S##3) R15(P,S##4) R15(P,S##5) R15(P,S##6) R15(P,S##7)
+#define R19(P, S) R18(P,S##0) R18(P,S##1)
+#define R20(P, S) R18(P,S##0) R18(P,S##1) R18(P,S##2) R18(P,S##3)
+
+#define REPEAT_(RN, P)	RN(P,)
+#define REPEAT2(N, P)	REPEAT_(R##N,P)
-- 
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