aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-12-16 06:18:08 +0100
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2020-12-29 14:54:25 +0100
commitf554ff373bfd3914fa68b4983fd8f351840e70d8 (patch)
treee06b6c647a9fde09cb1d7ca28f16c48ea5937313
parent6956d2711272f2781690a79bae5bfa5ca3dada2e (diff)
downloadsparse-f554ff373bfd3914fa68b4983fd8f351840e70d8.tar.gz
fix rem_usage()
rem_usage() is used to remove an element from a def-use chain. Optionally, if the chain become empty, the defining instruction can also be killed. This optional part is currently be done on all pseudos but only those having a definition should be concerned. Fix this by adding a check so that only PSEUDO_REGs and PSEUDO_PHIs are killed. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r--simplify.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/simplify.c b/simplify.c
index a877b693..12482d78 100644
--- a/simplify.c
+++ b/simplify.c
@@ -271,7 +271,7 @@ static inline void rem_usage(pseudo_t p, pseudo_t *usep, int kill)
{
if (has_use_list(p)) {
delete_pseudo_user_list_entry(&p->users, usep, 1);
- if (kill && !p->users)
+ if (kill && !p->users && has_definition(p))
kill_instruction(p->def);
}
}