diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-12-02 00:08:21 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-12-02 00:08:21 +0100 |
commit | 269d7b9ec7a7d7ba6dcb5f4ca29ef888ce79f06a (patch) | |
tree | 670f5aba9e6f89a169f6aee55811e34b91645f8c | |
parent | 9aa51a90505e1ba8c0c722b65756809830dcd662 (diff) | |
parent | 701ce0cadbd5eb0655ab0c33de5c8a337a498a34 (diff) | |
download | sparse-269d7b9ec7a7d7ba6dcb5f4ca29ef888ce79f06a.tar.gz |
Merge branches 'fix-kill_dominated_stores' and 'kill-dead-loads' into next
* memops: fix wrong killing of stores partially dominated by a load
* memops: kill dead loads before phi-node conversion
-rw-r--r-- | memops.c | 5 | ||||
-rw-r--r-- | validation/memops/kill-dead-loads00.c | 22 |
2 files changed, 27 insertions, 0 deletions
@@ -111,6 +111,11 @@ static void simplify_loads(struct basic_block *bb) if (insn->is_volatile) continue; + if (!has_users(insn->target)) { + kill_instruction(insn); + continue; + } + RECURSE_PTR_REVERSE(insn, dom) { int dominance; if (!dom->bb) diff --git a/validation/memops/kill-dead-loads00.c b/validation/memops/kill-dead-loads00.c new file mode 100644 index 00000000..df7ec037 --- /dev/null +++ b/validation/memops/kill-dead-loads00.c @@ -0,0 +1,22 @@ +void fun(void); + +void foo(int *p) +{ + for (*p; *p; *p) { +l: + fun(); + } + + if (0) + goto l; +} + +/* + * check-name: kill-dead-loads00 + * check-command: test-linearize -Wno-decl $file + * + * check-output-ignore + * check-output-excludes: phi\\. + * check-output-pattern(1): load\\. + * check-output-end + */ |