diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-04-26 18:01:06 +0200 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-14 12:39:33 +0100 |
| commit | f9aa068780dac8a6246c65d95792f4af688bd9c9 (patch) | |
| tree | 51e70081ec2e7c46eca50410b7b5819bc9c266d1 /validation/optim | |
| parent | f5a6877758aa1ee86a41bdecaa2747e88d74aaef (diff) | |
| download | sparse-dev-f9aa068780dac8a6246c65d95792f4af688bd9c9.tar.gz | |
kill dead loads
Like others instructions producing a value, OP_LOADs can be dead.
But currently, dead OP_LOAD are not removed as dead_insn() do
for others instructions.
Fix this by checking at simplification time if OP_LOADs are
dead and call kill_instruction() if it is the case.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/optim')
| -rw-r--r-- | validation/optim/load-dead.c | 11 | ||||
| -rw-r--r-- | validation/optim/load-semi-volatile.c | 25 |
2 files changed, 36 insertions, 0 deletions
diff --git a/validation/optim/load-dead.c b/validation/optim/load-dead.c new file mode 100644 index 00000000..52538cc2 --- /dev/null +++ b/validation/optim/load-dead.c @@ -0,0 +1,11 @@ +void foo(int *p) { *p; } + +int *p; +void bar(void) { *p; } + +/* + * check-name: load-dead + * check-command: test-linearize -Wno-decl $file + * check-output-ignore + * check-output-excludes: load\\. + */ diff --git a/validation/optim/load-semi-volatile.c b/validation/optim/load-semi-volatile.c new file mode 100644 index 00000000..0e266e17 --- /dev/null +++ b/validation/optim/load-semi-volatile.c @@ -0,0 +1,25 @@ +struct s { + volatile int a; +}; + +struct s s; + +void foo(void) +{ + s; + s.a; +} + +/* + * check-name: load-semi-volatile + * check-command: test-linearize -Wno-decl $file + * check-known-to-fail + * + * check-output-ignore + * check-output-pattern(1): load + * + * check-description: + * The load at line 9 must be removed. + * The load at line 10 is volatile and thus + * must not be removed. + */ |
