aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/memops.c
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-01-06 01:01:18 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-11-29 23:06:59 +0100
commit701ce0cadbd5eb0655ab0c33de5c8a337a498a34 (patch)
tree5e398f1e90946d6fd85c6dd8dc52587dd897df4a /memops.c
parent540c2c4bf47f0c517c042ff689679b2900bb36a5 (diff)
downloadsparse-dev-701ce0cadbd5eb0655ab0c33de5c8a337a498a34.tar.gz
memops: kill dead loads before phi-node conversion
During load simplification it may happen that a load is unused but if this fact is ignored and the usual conversion to a phi-node is made, then this value may seem to be needed and can't anymore be simplified away. Fix this by removing dead loads during load simplification. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'memops.c')
-rw-r--r--memops.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/memops.c b/memops.c
index badcdbbb..6baf4d16 100644
--- a/memops.c
+++ b/memops.c
@@ -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)