diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-06 20:15:58 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2018-02-14 12:37:21 +0100 |
| commit | 56f6d4dd747ac524e4e93d4aa7a8281e64b416bc (patch) | |
| tree | 53849d086c7f786982716193f2925161027b230a | |
| parent | 154b19b15cecd661b6498fb7683920c5cf8dd938 (diff) | |
| download | sparse-dev-56f6d4dd747ac524e4e93d4aa7a8281e64b416bc.tar.gz | |
fix killing of converted loads
Converted loads are dead and can be removed but that
also means that the address usage need to be adjusted
which wasn't done.
Fix this by directly using kill_instruction().
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
| -rw-r--r-- | flow.c | 4 | ||||
| -rw-r--r-- | validation/optim/load-converted.c | 1 | ||||
| -rw-r--r-- | validation/optim/load-semi-volatile.c | 25 |
3 files changed, 26 insertions, 4 deletions
@@ -305,9 +305,7 @@ void convert_instruction_target(struct instruction *insn, pseudo_t src) void convert_load_instruction(struct instruction *insn, pseudo_t src) { convert_instruction_target(insn, src); - /* Turn the load into a no-op */ - insn->opcode = OP_LNOP; - insn->bb = NULL; + kill_instruction(insn); } static int overlapping_memop(struct instruction *a, struct instruction *b) diff --git a/validation/optim/load-converted.c b/validation/optim/load-converted.c index 010c6bc7..7cbb53cf 100644 --- a/validation/optim/load-converted.c +++ b/validation/optim/load-converted.c @@ -8,7 +8,6 @@ static int foo(int *p, int i) /* * check-name: load-converted * check-command: test-linearize -Wno-decl $file - * check-known-to-fail * * check-output-ignore * check-output-excludes: add\. 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. + */ |
