diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-03-11 10:41:58 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-03-14 16:57:00 +0100 |
| commit | 88fbab0c7465b682c386f759d4b6ecc3339cd08e (patch) | |
| tree | 92a7ed347ae14fcfbac8e5270c3881cfc160a19c /validation/optim | |
| parent | 9b69a4bfa543068f5bfd23edd2c7b2b41300cb9a (diff) | |
| download | sparse-dev-88fbab0c7465b682c386f759d4b6ecc3339cd08e.tar.gz | |
optim: add some more optimization tests
Add some tests showing missed optimization opportunities.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/dup-cond0.c | 20 | ||||
| -rw-r--r-- | validation/optim/phi-ret.c | 22 |
2 files changed, 42 insertions, 0 deletions
diff --git a/validation/optim/dup-cond0.c b/validation/optim/dup-cond0.c new file mode 100644 index 00000000..dc4991cb --- /dev/null +++ b/validation/optim/dup-cond0.c @@ -0,0 +1,20 @@ +struct s { + int f; +}; + +static int foo(struct s *s) +{ + if (s->f) + return 0; + else if (!s->f) + return 4; +} + +/* + * check-name: dup-cond0 + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-contains: select + */ diff --git a/validation/optim/phi-ret.c b/validation/optim/phi-ret.c new file mode 100644 index 00000000..204366a9 --- /dev/null +++ b/validation/optim/phi-ret.c @@ -0,0 +1,22 @@ +int foo(int p, int q, int v) +{ + if (q) { + if (p) { + v = p; + p = 0; + } + } else + p = 0; + if (p) + return v + 1; + return q; +} + +/* + * check-name: phi-ret + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-excludes: phi\\. + */ |
