diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-08-30 14:41:54 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-09-06 02:56:58 +0200 |
| commit | 45c5f24a17690d2d4276fadb6c02a78e44843b23 (patch) | |
| tree | 31f4d87b5db58e6dc397528fa1b17fa3a2efd74d /validation | |
| parent | 6aa0dd51b56f434162e806d50930f165c7804379 (diff) | |
| download | sparse-dev-45c5f24a17690d2d4276fadb6c02a78e44843b23.tar.gz | |
add testcases for wrong ordering in phi-nodes
In valid SSA there is a 1-to-1 correspondance between
each operand of a phi-node and the parents BB.
However, currently, this is not always respected.
Add testcases for the known problems.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation')
| -rw-r--r-- | validation/linear/phi-order01.c | 17 | ||||
| -rw-r--r-- | validation/linear/phi-order02.c | 17 | ||||
| -rw-r--r-- | validation/linear/phi-order03.c | 9 | ||||
| -rw-r--r-- | validation/linear/phi-order04.c | 12 |
4 files changed, 55 insertions, 0 deletions
diff --git a/validation/linear/phi-order01.c b/validation/linear/phi-order01.c new file mode 100644 index 00000000..18f2acbc --- /dev/null +++ b/validation/linear/phi-order01.c @@ -0,0 +1,17 @@ +int fun(void); + +static int foo(int a) +{ + return a && fun(); +} + +static int bar(int a) +{ + return a || fun(); +} + +/* + * check-name: phi-order01 + * check-command: sparse -vir -flinearize=last $file + * check-known-to-fail + */ diff --git a/validation/linear/phi-order02.c b/validation/linear/phi-order02.c new file mode 100644 index 00000000..5dd4b38e --- /dev/null +++ b/validation/linear/phi-order02.c @@ -0,0 +1,17 @@ +int fun(void); + +static int foo(int a) { return 0 || fun(); } +static int bar(int a) { return 1 || fun(); } +static int baz(int a) { return 0 && fun(); } +static int qux(int a) { return 1 && fun(); } + +static int oof(int a) { return fun() || 1; } +static int rab(int a) { return fun() || 0; } +static int zab(int a) { return fun() && 1; } +static int xuq(int a) { return fun() && 0; } + +/* + * check-name: phi-order02 + * check-command: sparse -vir -flinearize=last $file + * check-known-to-fail + */ diff --git a/validation/linear/phi-order03.c b/validation/linear/phi-order03.c new file mode 100644 index 00000000..316cfeeb --- /dev/null +++ b/validation/linear/phi-order03.c @@ -0,0 +1,9 @@ +int fun(void); + +static int foo(void) { return ((0 || fun()) && fun()); } + +/* + * check-name: phi-order03 + * check-command: sparse -vir -flinearize=last $file + * check-known-to-fail + */ diff --git a/validation/linear/phi-order04.c b/validation/linear/phi-order04.c new file mode 100644 index 00000000..7548537a --- /dev/null +++ b/validation/linear/phi-order04.c @@ -0,0 +1,12 @@ +static void foo(int *b) +{ + if (1) { + int c; + b = &c; + } +} + +/* + * check-name: phi-order04 + * check-command: sparse -vir -flinearize=last $file + */ |
