aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-25 14:29:48 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-08-25 14:55:25 +0200
commit96f388f0f55cfa1984daa70d7dc4faa63a85c590 (patch)
tree5a8af02749000a8228f4d8f68720f088356faef6 /validation
parentd46b7b2f9fc4769d8dce72913bfac370f1d69df5 (diff)
parent3f06ccfcc0be01c0d5bc6a982c2fbadf62fa502a (diff)
downloadsparse-dev-96f388f0f55cfa1984daa70d7dc4faa63a85c590.tar.gz
Merge branch 'ssa' into tip
* do 'classical' SSA conversion (via the iterated dominance frontier). Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
-rw-r--r--validation/crash-select.c18
-rw-r--r--validation/linear/compound-literal00.c (renamed from validation/compound-literal00.c)0
-rw-r--r--validation/linear/compound-literal01.c18
-rw-r--r--validation/linear/compound-literal02.c (renamed from validation/compound-literal01.c)10
-rw-r--r--validation/linear/logical.c70
-rw-r--r--validation/mem2reg/alias-distinct.c (renamed from validation/alias-distinct.c)0
-rw-r--r--validation/mem2reg/alias-mixed.c (renamed from validation/alias-mixed.c)0
-rw-r--r--validation/mem2reg/alias-same.c (renamed from validation/alias-same.c)0
-rw-r--r--validation/mem2reg/broken-phi02.c1
-rw-r--r--validation/mem2reg/broken-phi03.c1
-rw-r--r--validation/mem2reg/cond-expr.c1
-rw-r--r--validation/mem2reg/cond-expr5.c5
-rw-r--r--validation/mem2reg/init-global-array.c12
-rw-r--r--validation/mem2reg/init-local-array.c13
-rw-r--r--validation/mem2reg/loop02-global.c2
-rw-r--r--validation/mem2reg/missing-return.c34
-rw-r--r--validation/mem2reg/quadra00.c1
-rw-r--r--validation/mem2reg/quadra01.c27
-rw-r--r--validation/mem2reg/quadra02.c18
-rw-r--r--validation/mem2reg/reload-aliasing.c (renamed from validation/reload-aliasing.c)0
-rw-r--r--validation/mem2reg/store-deadborn.c9
-rw-r--r--validation/mem2reg/stray-phisrc.c (renamed from validation/linear/stray-phisrc.c)1
-rw-r--r--validation/mem2reg/struct.c32
-rw-r--r--validation/mem2reg/undef00.c15
-rw-r--r--validation/mem2reg/undef01.c16
-rw-r--r--validation/mem2reg/unused-var.c23
-rw-r--r--validation/optim/cse-size.c3
-rw-r--r--validation/optim/killed-insn.c (renamed from validation/mem2reg/killed-insn.c)7
-rw-r--r--validation/optim/missing-select.c1
-rw-r--r--validation/optim/null-phi.c9
-rw-r--r--validation/repeat.h24
-rw-r--r--validation/var-undef-partial.c1
32 files changed, 301 insertions, 71 deletions
diff --git a/validation/crash-select.c b/validation/crash-select.c
new file mode 100644
index 00000000..cec00baf
--- /dev/null
+++ b/validation/crash-select.c
@@ -0,0 +1,18 @@
+struct s {
+ void *b;
+ long c;
+};
+
+long d(void);
+static long f(void)
+{
+ struct s s;
+ s.c = d();
+ if (s.c)
+ s.c = 2;
+ return s.c;
+}
+
+/*
+ * check-name: crash-select
+ */
diff --git a/validation/compound-literal00.c b/validation/linear/compound-literal00.c
index f3069d2c..f3069d2c 100644
--- a/validation/compound-literal00.c
+++ b/validation/linear/compound-literal00.c
diff --git a/validation/linear/compound-literal01.c b/validation/linear/compound-literal01.c
new file mode 100644
index 00000000..e45fade3
--- /dev/null
+++ b/validation/linear/compound-literal01.c
@@ -0,0 +1,18 @@
+struct bfs {
+ int a: 2;
+ int b: 30;
+};
+
+int foo(void)
+{
+ struct bfs bf = { .a = 1, .b = 2 };
+ return (struct bfs[]){bf}[0].b;
+}
+
+/*
+ * check-name: compound-literal01.c
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-contains: ret\\..*\\$2
+ */
diff --git a/validation/compound-literal01.c b/validation/linear/compound-literal02.c
index 8a4935ea..87b98d76 100644
--- a/validation/compound-literal01.c
+++ b/validation/linear/compound-literal02.c
@@ -3,12 +3,6 @@ struct bfs {
int b: 30;
};
-int foo(void)
-{
- struct bfs bf = { .a = 1, .b = 2 };
- return (struct bfs[]){bf}[0].b;
-}
-
int bar(void)
{
struct bfs bf = { .a = 1, .b = 4 };
@@ -16,12 +10,10 @@ int bar(void)
}
/*
- * check-name: compound-literal01.c
+ * check-name: compound-literal02.c
* check-command: test-linearize -Wno-decl $file
*
* check-known-to-fail
* check-output-ignore
- * check-output-contains: ret\\..*\\$2
* check-output-contains: ret\\..*\\$6
- * check-error-end
*/
diff --git a/validation/linear/logical.c b/validation/linear/logical.c
index 148ad427..0f502c6b 100644
--- a/validation/linear/logical.c
+++ b/validation/linear/logical.c
@@ -56,7 +56,7 @@ ou:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi5 <- $1
+ phisrc.32 %phi4 <- $1
load.32 %r11 <- 0[i]
setne.1 %r12 <- %r11, $0
cbr %r12, .L7, .L6
@@ -68,16 +68,16 @@ ou:
trunc.3 %r16 <- (32) %r15
setne.1 %r17 <- %r16, $0
zext.32 %r18 <- (1) %r17
- phisrc.32 %phi6 <- %r18
+ phisrc.32 %phi5 <- %r18
br .L7
.L7:
- phi.32 %r19 <- %phi5, %phi6
- phisrc.32 %phi7(return) <- %r19
+ phi.32 %r19 <- %phi4, %phi5
+ phisrc.32 %phi6(return) <- %r19
br .L5
.L5:
- phi.32 %r20 <- %phi7(return)
+ phi.32 %r20 <- %phi6(return)
ret.32 %r20
@@ -86,7 +86,7 @@ ol:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi9 <- $1
+ phisrc.32 %phi7 <- $1
load.32 %r21 <- 0[i]
setne.1 %r22 <- %r21, $0
cbr %r22, .L11, .L10
@@ -96,16 +96,16 @@ ol:
load.64 %r24 <- 8[%r23]
setne.1 %r25 <- %r24, $0
zext.32 %r26 <- (1) %r25
- phisrc.32 %phi10 <- %r26
+ phisrc.32 %phi8 <- %r26
br .L11
.L11:
- phi.32 %r27 <- %phi9, %phi10
- phisrc.32 %phi11(return) <- %r27
+ phi.32 %r27 <- %phi7, %phi8
+ phisrc.32 %phi9(return) <- %r27
br .L9
.L9:
- phi.32 %r28 <- %phi11(return)
+ phi.32 %r28 <- %phi9(return)
ret.32 %r28
@@ -114,7 +114,7 @@ od:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi13 <- $1
+ phisrc.32 %phi10 <- $1
load.32 %r29 <- 0[i]
setne.1 %r30 <- %r29, $0
cbr %r30, .L15, .L14
@@ -125,16 +125,16 @@ od:
setfval.64 %r33 <- 0.000000e+00
fcmpune.1 %r34 <- %r32, %r33
zext.32 %r35 <- (1) %r34
- phisrc.32 %phi14 <- %r35
+ phisrc.32 %phi11 <- %r35
br .L15
.L15:
- phi.32 %r36 <- %phi13, %phi14
- phisrc.32 %phi15(return) <- %r36
+ phi.32 %r36 <- %phi10, %phi11
+ phisrc.32 %phi12(return) <- %r36
br .L13
.L13:
- phi.32 %r37 <- %phi15(return)
+ phi.32 %r37 <- %phi12(return)
ret.32 %r37
@@ -143,7 +143,7 @@ as:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi17 <- $0
+ phisrc.32 %phi13 <- $0
load.32 %r38 <- 0[i]
setne.1 %r39 <- %r38, $0
cbr %r39, .L18, .L19
@@ -155,16 +155,16 @@ as:
trunc.2 %r43 <- (32) %r42
setne.1 %r44 <- %r43, $0
zext.32 %r45 <- (1) %r44
- phisrc.32 %phi18 <- %r45
+ phisrc.32 %phi14 <- %r45
br .L19
.L19:
- phi.32 %r46 <- %phi18, %phi17
- phisrc.32 %phi19(return) <- %r46
+ phi.32 %r46 <- %phi14, %phi13
+ phisrc.32 %phi15(return) <- %r46
br .L17
.L17:
- phi.32 %r47 <- %phi19(return)
+ phi.32 %r47 <- %phi15(return)
ret.32 %r47
@@ -173,7 +173,7 @@ au:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi21 <- $0
+ phisrc.32 %phi16 <- $0
load.32 %r48 <- 0[i]
setne.1 %r49 <- %r48, $0
cbr %r49, .L22, .L23
@@ -185,16 +185,16 @@ au:
trunc.3 %r53 <- (32) %r52
setne.1 %r54 <- %r53, $0
zext.32 %r55 <- (1) %r54
- phisrc.32 %phi22 <- %r55
+ phisrc.32 %phi17 <- %r55
br .L23
.L23:
- phi.32 %r56 <- %phi22, %phi21
- phisrc.32 %phi23(return) <- %r56
+ phi.32 %r56 <- %phi17, %phi16
+ phisrc.32 %phi18(return) <- %r56
br .L21
.L21:
- phi.32 %r57 <- %phi23(return)
+ phi.32 %r57 <- %phi18(return)
ret.32 %r57
@@ -203,7 +203,7 @@ al:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi25 <- $0
+ phisrc.32 %phi19 <- $0
load.32 %r58 <- 0[i]
setne.1 %r59 <- %r58, $0
cbr %r59, .L26, .L27
@@ -213,16 +213,16 @@ al:
load.64 %r61 <- 8[%r60]
setne.1 %r62 <- %r61, $0
zext.32 %r63 <- (1) %r62
- phisrc.32 %phi26 <- %r63
+ phisrc.32 %phi20 <- %r63
br .L27
.L27:
- phi.32 %r64 <- %phi26, %phi25
- phisrc.32 %phi27(return) <- %r64
+ phi.32 %r64 <- %phi20, %phi19
+ phisrc.32 %phi21(return) <- %r64
br .L25
.L25:
- phi.32 %r65 <- %phi27(return)
+ phi.32 %r65 <- %phi21(return)
ret.32 %r65
@@ -231,7 +231,7 @@ ad:
<entry-point>
store.32 %arg1 -> 0[i]
store.64 %arg2 -> 0[b]
- phisrc.32 %phi29 <- $0
+ phisrc.32 %phi22 <- $0
load.32 %r66 <- 0[i]
setne.1 %r67 <- %r66, $0
cbr %r67, .L30, .L31
@@ -242,16 +242,16 @@ ad:
setfval.64 %r70 <- 0.000000e+00
fcmpune.1 %r71 <- %r69, %r70
zext.32 %r72 <- (1) %r71
- phisrc.32 %phi30 <- %r72
+ phisrc.32 %phi23 <- %r72
br .L31
.L31:
- phi.32 %r73 <- %phi30, %phi29
- phisrc.32 %phi31(return) <- %r73
+ phi.32 %r73 <- %phi23, %phi22
+ phisrc.32 %phi24(return) <- %r73
br .L29
.L29:
- phi.32 %r74 <- %phi31(return)
+ phi.32 %r74 <- %phi24(return)
ret.32 %r74
diff --git a/validation/alias-distinct.c b/validation/mem2reg/alias-distinct.c
index 42937b24..42937b24 100644
--- a/validation/alias-distinct.c
+++ b/validation/mem2reg/alias-distinct.c
diff --git a/validation/alias-mixed.c b/validation/mem2reg/alias-mixed.c
index 0cfbe36b..0cfbe36b 100644
--- a/validation/alias-mixed.c
+++ b/validation/mem2reg/alias-mixed.c
diff --git a/validation/alias-same.c b/validation/mem2reg/alias-same.c
index 55cf4244..55cf4244 100644
--- a/validation/alias-same.c
+++ b/validation/mem2reg/alias-same.c
diff --git a/validation/mem2reg/broken-phi02.c b/validation/mem2reg/broken-phi02.c
index 69776e0f..5aa65071 100644
--- a/validation/mem2reg/broken-phi02.c
+++ b/validation/mem2reg/broken-phi02.c
@@ -22,7 +22,6 @@ int foo(int a, int b)
* is used) causes a missed select-conversion at later stage.
*
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
* check-output-ignore
* check-output-contains: select\\.
*/
diff --git a/validation/mem2reg/broken-phi03.c b/validation/mem2reg/broken-phi03.c
index 58b47979..eff1ff8a 100644
--- a/validation/mem2reg/broken-phi03.c
+++ b/validation/mem2reg/broken-phi03.c
@@ -23,7 +23,6 @@ int foo(int a, int b)
* is used) causes a missed select-conversion at later stage.
*
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
* check-output-ignore
* check-output-contains: select\\.
*/
diff --git a/validation/mem2reg/cond-expr.c b/validation/mem2reg/cond-expr.c
index f38564ef..8acb00ac 100644
--- a/validation/mem2reg/cond-expr.c
+++ b/validation/mem2reg/cond-expr.c
@@ -10,4 +10,5 @@ int foo(int a, int b, int c)
* check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
* check-output-ignore
* check-output-pattern(2): phi\\.
+ * check-output-pattern(3): phisrc\\.
*/
diff --git a/validation/mem2reg/cond-expr5.c b/validation/mem2reg/cond-expr5.c
index 6c1e1c34..a3ce5e3a 100644
--- a/validation/mem2reg/cond-expr5.c
+++ b/validation/mem2reg/cond-expr5.c
@@ -11,8 +11,11 @@ int foo(int p, int q, int a)
/*
* check-name: cond-expr5
* check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
+ *
* check-output-ignore
* check-output-excludes: load\\.
* check-output-excludes: store\\.
- * check-output-pattern(2): phi\\.
+ * check-output-excludes: phi\\..*, .*, .*
+ * check-output-pattern(3): phi\\.
+ * check-output-pattern(5): phisrc\\.
*/
diff --git a/validation/mem2reg/init-global-array.c b/validation/mem2reg/init-global-array.c
index aea4135a..51ca50e3 100644
--- a/validation/mem2reg/init-global-array.c
+++ b/validation/mem2reg/init-global-array.c
@@ -1,8 +1,11 @@
-struct {
+struct s {
int a[2];
-} s;
+};
-int sarray(void)
+
+static struct s s;
+
+static int sarray(void)
{
s.a[1] = 1;
return s.a[1];
@@ -10,8 +13,9 @@ int sarray(void)
/*
* check-name: init global array
- * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
+ * check-command: test-linearize $file
* check-output-ignore
* check-output-excludes: load\\.
* check-output-pattern(1): store\\.
+ * check-output-pattern(1): ret.32 *\\$1
*/
diff --git a/validation/mem2reg/init-local-array.c b/validation/mem2reg/init-local-array.c
index 2ac53bc7..639a74f1 100644
--- a/validation/mem2reg/init-local-array.c
+++ b/validation/mem2reg/init-local-array.c
@@ -1,25 +1,28 @@
-int array(void)
+static int array(void)
{
int a[2];
a[1] = 1;
+ a[0] = 0;
return a[1];
}
-int sarray(void)
+static int sarray(void)
{
struct {
int a[2];
} s;
s.a[1] = 1;
+ s.a[0] = 0;
return s.a[1];
}
/*
* check-name: init local array
- * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
+ * check-command: test-linearize $file
* check-output-ignore
- * check-output-excludes: load\\.
- * check-output-excludes: store\\.
+ * check-output-excludes: load
+ * check-output-excludes: store
+ * check-output-pattern(2): ret.32 *\\$1
*/
diff --git a/validation/mem2reg/loop02-global.c b/validation/mem2reg/loop02-global.c
index a0a8b42b..b627b33d 100644
--- a/validation/mem2reg/loop02-global.c
+++ b/validation/mem2reg/loop02-global.c
@@ -16,7 +16,7 @@ int foo(void)
/*
* check-name: loop02 global
- * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
+ * check-command: test-linearize -Wno-decl $file
* check-output-ignore
* check-output-excludes: load\\.
*/
diff --git a/validation/mem2reg/missing-return.c b/validation/mem2reg/missing-return.c
new file mode 100644
index 00000000..06f6e4d5
--- /dev/null
+++ b/validation/mem2reg/missing-return.c
@@ -0,0 +1,34 @@
+int f1(void)
+{
+ if (1)
+ return 1;
+}
+
+int f0(void)
+{
+ if (0)
+ return 0;
+}
+
+int fx(int p)
+{
+ if (p)
+ return 0;
+}
+
+int bar(int p)
+{
+ if (p)
+ return 0;
+ p++;
+}
+
+/*
+ * check-name: missing-return
+ * check-command: test-linearize -m32 -fdump-ir=mem2reg -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-pattern(1): ret.32 *\\$1
+ * check-output-pattern(3): ret.32 *UNDEF
+ */
diff --git a/validation/mem2reg/quadra00.c b/validation/mem2reg/quadra00.c
index 63b489c9..69ddc977 100644
--- a/validation/mem2reg/quadra00.c
+++ b/validation/mem2reg/quadra00.c
@@ -20,7 +20,6 @@ int foo(int *a, int b, int c)
/*
* check-name: quadratic phisrc
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
* check-output-ignore
* check-output-excludes: phi\\..*, .*, .*
* check-output-excludes: phi\\..*, .*, .*, .*
diff --git a/validation/mem2reg/quadra01.c b/validation/mem2reg/quadra01.c
new file mode 100644
index 00000000..b71f4696
--- /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 00000000..6475c780
--- /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/reload-aliasing.c b/validation/mem2reg/reload-aliasing.c
index 3aad317b..3aad317b 100644
--- a/validation/reload-aliasing.c
+++ b/validation/mem2reg/reload-aliasing.c
diff --git a/validation/mem2reg/store-deadborn.c b/validation/mem2reg/store-deadborn.c
new file mode 100644
index 00000000..cca34d59
--- /dev/null
+++ b/validation/mem2reg/store-deadborn.c
@@ -0,0 +1,9 @@
+static void foo(int a)
+{
+ return;
+ a = 0;
+}
+
+/*
+ * check-name: store-deadborn
+ */
diff --git a/validation/linear/stray-phisrc.c b/validation/mem2reg/stray-phisrc.c
index e9f35c89..0da7df7a 100644
--- a/validation/linear/stray-phisrc.c
+++ b/validation/mem2reg/stray-phisrc.c
@@ -18,7 +18,6 @@ static int foo(int **g)
/*
* check-name: stray phisrc
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-excludes: phisrc\\.
diff --git a/validation/mem2reg/struct.c b/validation/mem2reg/struct.c
new file mode 100644
index 00000000..13962a8e
--- /dev/null
+++ b/validation/mem2reg/struct.c
@@ -0,0 +1,32 @@
+struct s {
+ int a;
+ int b;
+};
+
+int f0(void)
+{
+ struct s s;
+
+ s.a = 0;
+ s.b = 1;
+
+ return s.a;
+}
+
+int f1(void)
+{
+ struct s s;
+
+ s.a = 1;
+ s.b = 0;
+
+ return s.b;
+}
+
+/*
+ * check-name: struct
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-ignore
+ * check-output-pattern(2): ret.32 *\\$0
+ */
diff --git a/validation/mem2reg/undef00.c b/validation/mem2reg/undef00.c
index ba9ba915..20ea962c 100644
--- a/validation/mem2reg/undef00.c
+++ b/validation/mem2reg/undef00.c
@@ -1,14 +1,21 @@
-void bad0(void)
+static int badr(void)
{
int *a;
- *a++;
+ return *a;
+}
+
+static void badw(int v)
+{
+ int *a;
+ *a = v;
}
/*
* check-name: undef00
- * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file
- * check-known-to-fail
+ * check-command: test-linearize -fdump-ir=mem2reg $file
* check-output-ignore
* check-output-pattern(1): load\\.
* check-output-pattern(1): load\\..*\\[UNDEF\\]
+ * check-output-pattern(1): store\\.
+ * check-output-pattern(1): store\\..*\\[UNDEF\\]
*/
diff --git a/validation/mem2reg/undef01.c b/validation/mem2reg/undef01.c
new file mode 100644
index 00000000..985c73d6
--- /dev/null
+++ b/validation/mem2reg/undef01.c
@@ -0,0 +1,16 @@
+static void foo(void)
+{
+ int *b;
+ for (;;)
+ *b++ = 0;
+}
+
+/*
+ * check-name: undef01
+ * check-command: sparse -Wmaybe-uninitialized $file
+ * check-known-to-fail
+ *
+ * check-error-start
+crazy04.c:3:13: warning: variable 'b' may be uninitialized
+ * check-error-end
+ */
diff --git a/validation/mem2reg/unused-var.c b/validation/mem2reg/unused-var.c
new file mode 100644
index 00000000..ac394582
--- /dev/null
+++ b/validation/mem2reg/unused-var.c
@@ -0,0 +1,23 @@
+int foo(int a)
+{
+ switch (a) {
+ int u = 1;
+
+ default:
+ return a;
+ }
+}
+
+/*
+ * check-name: unused-var
+ * check-command: test-linearize -Wno-decl $file
+ *
+ * check-output-start
+foo:
+.L0:
+ <entry-point>
+ ret.32 %arg1
+
+
+ * check-output-end
+ */
diff --git a/validation/optim/cse-size.c b/validation/optim/cse-size.c
index b75e4bfe..e98c3cde 100644
--- a/validation/optim/cse-size.c
+++ b/validation/optim/cse-size.c
@@ -13,6 +13,5 @@ static void foo(void)
* check-command: test-linearize -Wno-decl $file
*
* check-output-ignore
- * check-output-excludes: phi\\.
- * check-output-excludes: phisrc\\.
+ * check-output-pattern(2): phi\\.
*/
diff --git a/validation/mem2reg/killed-insn.c b/validation/optim/killed-insn.c
index adbef980..d1cdd02e 100644
--- a/validation/mem2reg/killed-insn.c
+++ b/validation/optim/killed-insn.c
@@ -1,14 +1,13 @@
-static int g;
-static void foo(void)
+static void foo(int v)
{
int a[2] = { };
a;
- a[1] = g;
+ a[1] = v;
}
/*
* check-name: killed-insn
- * check-command: test-linearize -fdump-ir=mem2reg $file
+ * check-command: test-linearize $file
*
* check-output-ignore
* check-output-excludes: store\\.
diff --git a/validation/optim/missing-select.c b/validation/optim/missing-select.c
index 4796e058..07ea008f 100644
--- a/validation/optim/missing-select.c
+++ b/validation/optim/missing-select.c
@@ -17,7 +17,6 @@ static int foo(int **g)
/*
* check-name: missing-select
* check-command: test-linearize -Wno-decl $file
- * check-known-to-fail
*
* check-output-ignore
* check-output-contains: select\\.
diff --git a/validation/optim/null-phi.c b/validation/optim/null-phi.c
new file mode 100644
index 00000000..1f9de4d5
--- /dev/null
+++ b/validation/optim/null-phi.c
@@ -0,0 +1,9 @@
+static int foo(void)
+{
+ if (0)
+ return 0;
+}
+
+/*
+ * check-name: null-phi
+ */
diff --git a/validation/repeat.h b/validation/repeat.h
new file mode 100644
index 00000000..83433b2a
--- /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)
diff --git a/validation/var-undef-partial.c b/validation/var-undef-partial.c
index 2b665834..f1a07bea 100644
--- a/validation/var-undef-partial.c
+++ b/validation/var-undef-partial.c
@@ -16,6 +16,5 @@ int foo(int a, int b)
* check-description: trigger a bug in symbol/memop simplification
* check-description: sparse-llvm is used here as semantic checker of sparse's IR
* check-command: sparse-llvm -Wno-decl $file
- * check-known-to-fail
* check-output-ignore
*/