diff options
author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-12-04 17:08:33 +0100 |
---|---|---|
committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2020-12-04 17:08:38 +0100 |
commit | d08e3d0b695063a26e999e5188066f8eabf2c25a (patch) | |
tree | 82d31adbd9450c0f69f6b1a8c28c2f90ee867131 | |
parent | a00755aafac28395aeb8fb3b6eb9f3801574cc97 (diff) | |
download | sparse-d08e3d0b695063a26e999e5188066f8eabf2c25a.tar.gz |
fix killing OP_ASM
Currently OP_ASMs are only handled by default in kill_insn().
In consequence, the usage is not removed from their inputs,
possibly leaving dead pseudos.
Fix this by removing the usage on the input pseudos.
Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
-rw-r--r-- | simplify.c | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -308,6 +308,15 @@ static void kill_use_list(struct pseudo_list *list) } END_FOR_EACH_PTR(p); } +static void kill_asm(struct instruction *insn) +{ + struct asm_constraint *con; + + FOR_EACH_PTR(insn->asm_rules->inputs, con) { + kill_use(&con->pseudo); + } END_FOR_EACH_PTR(con); +} + /// // kill an instruction // @insn: the instruction to be killed @@ -373,6 +382,12 @@ int kill_insn(struct instruction *insn, int force) kill_use(&insn->target); break; + case OP_ASM: + if (!force) + return 0; + kill_asm(insn); + break; + case OP_ENTRY: /* ignore */ return 0; |