From b8c17466f25794ff9bf444f058cadf637745a02d Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Tue, 6 Mar 2018 05:02:56 +0100 Subject: testsuite: improve mem2reg testcases A few tests are added, some have been renamed to better refect their purposes. Finally, some checks have been added or tweaked. Signed-off-by: Luc Van Oostenryck --- validation/optim/killed-insn.c | 14 ++++++++++++++ validation/optim/null-phi.c | 9 +++++++++ 2 files changed, 23 insertions(+) create mode 100644 validation/optim/killed-insn.c create mode 100644 validation/optim/null-phi.c (limited to 'validation/optim') diff --git a/validation/optim/killed-insn.c b/validation/optim/killed-insn.c new file mode 100644 index 00000000..d1cdd02e --- /dev/null +++ b/validation/optim/killed-insn.c @@ -0,0 +1,14 @@ +static void foo(int v) +{ + int a[2] = { }; + a; + a[1] = v; +} + +/* + * check-name: killed-insn + * check-command: test-linearize $file + * + * check-output-ignore + * check-output-excludes: store\\. + */ 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 + */ -- cgit 1.2.3-korg From 6dea652c4ac3aec57ffb1ce7c333184d324971f8 Mon Sep 17 00:00:00 2001 From: Luc Van Oostenryck Date: Mon, 9 Apr 2018 16:49:09 +0200 Subject: ssa: activate the new SSA conversion This activate the new SSA conversion that will be used to replace simplify_symbol_usage() which created invalid SSA (phi-nodes were placed where the value was needed instead of where the paths meet, also and partially related, it was possible for a phi-node to have more operands/sources than the BB it was in had parents). Signed-off-by: Luc Van Oostenryck --- optimize.c | 3 ++- validation/mem2reg/broken-phi02.c | 1 - validation/mem2reg/broken-phi03.c | 1 - validation/mem2reg/cond-expr5.c | 1 - validation/mem2reg/quadra00.c | 1 - validation/mem2reg/quadra01.c | 1 + validation/mem2reg/stray-phisrc.c | 1 - validation/mem2reg/undef00.c | 1 - validation/optim/cse-size.c | 3 +-- validation/optim/missing-select.c | 1 - validation/var-undef-partial.c | 1 - 11 files changed, 4 insertions(+), 11 deletions(-) (limited to 'validation/optim') diff --git a/optimize.c b/optimize.c index e682b7b2..e8cb7fc3 100644 --- a/optimize.c +++ b/optimize.c @@ -13,6 +13,7 @@ #include "flow.h" #include "cse.h" #include "ir.h" +#include "ssa.h" int repeat_phase; @@ -60,7 +61,7 @@ void optimize(struct entrypoint *ep) * Turn symbols into pseudos */ if (fpasses & PASS_MEM2REG) - simplify_symbol_usage(ep); + ssa_convert(ep); ir_validate(ep); if (fdump_ir & PASS_MEM2REG) show_entry(ep); 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-expr5.c b/validation/mem2reg/cond-expr5.c index 62ac6c15..a3ce5e3a 100644 --- a/validation/mem2reg/cond-expr5.c +++ b/validation/mem2reg/cond-expr5.c @@ -11,7 +11,6 @@ int foo(int p, int q, int a) /* * check-name: cond-expr5 * check-command: test-linearize -Wno-decl -fdump-ir=mem2reg $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: load\\. 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 index b71f4696..bab337f2 100644 --- a/validation/mem2reg/quadra01.c +++ b/validation/mem2reg/quadra01.c @@ -20,6 +20,7 @@ static void foo(void) { * check-name: quadratic @ liveness * check-command: test-linearize -I. $file * check-timeout: + * check-known-to-fail * * check-output-ignore * check-output-excludes: phi\\. diff --git a/validation/mem2reg/stray-phisrc.c b/validation/mem2reg/stray-phisrc.c index e9f35c89..0da7df7a 100644 --- a/validation/mem2reg/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/undef00.c b/validation/mem2reg/undef00.c index 27f0aaa8..20ea962c 100644 --- a/validation/mem2reg/undef00.c +++ b/validation/mem2reg/undef00.c @@ -13,7 +13,6 @@ static void badw(int v) /* * check-name: undef00 * check-command: test-linearize -fdump-ir=mem2reg $file - * check-known-to-fail * check-output-ignore * check-output-pattern(1): load\\. * check-output-pattern(1): load\\..*\\[UNDEF\\] 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/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/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 */ -- cgit 1.2.3-korg