diff mbox

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

Message ID 20180319005418.18548-3-luc.vanoostenryck@gmail.com (mailing list archive)
State Mainlined, archived
Headers show

Commit Message

Luc Van Oostenryck March 19, 2018, 12:54 a.m. UTC
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
 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 mbox

Patch

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)