make_usage() kill the corresponding instruction when the last user have been removed. This is often desired but not always. Make a new version __remove_usage() taking a flag telling if we want to kill the instruction or not. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/simplify.c b/simplify.c index 0a3207404..247c591d7 100644 --- a/simplify.c +++ b/simplify.c @@ -184,23 +184,28 @@ out: return count; } -static inline void remove_usage(pseudo_t p, pseudo_t *usep) +static inline void __remove_usage(pseudo_t p, pseudo_t *usep, int kill) { if (has_use_list(p)) { if (p->type == PSEUDO_SYM) repeat_phase |= REPEAT_SYMBOL_CLEANUP; delete_pseudo_user_list_entry(&p->users, usep, 1); - if (!p->users) + if (kill && !p->users) kill_instruction(p->def); } } +static inline void remove_usage(pseudo_t p, pseudo_t *usep) +{ + __remove_usage(p, usep, 1); +} + void kill_use(pseudo_t *usep) { if (usep) { pseudo_t p = *usep; *usep = VOID; - remove_usage(p, usep); + __remove_usage(p, usep, 1); } } -- 2.16.2 -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html