diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2017-02-16 05:57:05 +0100 |
|---|---|---|
| committer | Christopher Li <sparse@chrisli.org> | 2017-02-16 20:43:10 +0800 |
| commit | 700ab906a3842184cf48031a575341e4aae6efb4 (patch) | |
| tree | 35d240009ae5a41d955451d8955e73257e6f665c | |
| parent | 2e9471d51289b7b67090ee06c475fe7d2b8e6ede (diff) | |
| download | sparse-dev-700ab906a3842184cf48031a575341e4aae6efb4.tar.gz | |
fix killing of rewritten loads
OP_LOADs removed by rewrite_load_instruction() had their ->bb simply
set to NULL the usage of its operand was not adjusted.
Fix that by calling kill_instruction().
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Signed-off-by: Christopher Li <sparse@chrisli.org>
| -rw-r--r-- | flow.c | 2 | ||||
| -rw-r--r-- | validation/kill-rewritten-load.c | 16 |
2 files changed, 17 insertions, 1 deletions
@@ -401,7 +401,7 @@ void rewrite_load_instruction(struct instruction *insn, struct pseudo_list *domi * pseudo. */ FOR_EACH_PTR(dominators, phi) { - phi->def->bb = NULL; + kill_instruction(phi->def); } END_FOR_EACH_PTR(phi); convert_load_instruction(insn, new); return; diff --git a/validation/kill-rewritten-load.c b/validation/kill-rewritten-load.c new file mode 100644 index 00000000..31b895e5 --- /dev/null +++ b/validation/kill-rewritten-load.c @@ -0,0 +1,16 @@ +int foo(int i) +{ + i++; + if (i && 0) + i; + return 0; +} + + +/* + * check-name: kill-rewritten-load + * check-command: test-linearize -Wno-decl $file + * check-output-ignore + * + * check-output-excludes: add\\. + */ |
