--- mem2reg.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/mem2reg.c b/mem2reg.c index 7096a4bf2..4671d4710 100644 --- a/mem2reg.c +++ b/mem2reg.c @@ -148,6 +148,17 @@ static void kill_store(struct instruction *insn) } } +static void kill_pseudo_stores(pseudo_t pseudo) +{ + struct pseudo_user *pu; + + FOR_EACH_PTR(pseudo->users, pu) { + struct instruction *insn = pu->insn; + if (insn->opcode == OP_STORE) + kill_store(insn); + } END_FOR_EACH_PTR(pu); +} + /* Kill a pseudo that is dead on exit from the bb */ static void kill_dead_stores(pseudo_t pseudo, unsigned long generation, struct basic_block *bb, int local) { @@ -307,11 +318,7 @@ static void promote_symbol(struct entrypoint *ep, struct symbol *sym) /* If we converted all the loads, remove the stores. They are dead */ if (all && !mod) { - FOR_EACH_PTR(pseudo->users, pu) { - struct instruction *insn = pu->insn; - if (insn->opcode == OP_STORE) - kill_store(insn); - } END_FOR_EACH_PTR(pu); + return kill_pseudo_stores(pseudo); } else { /* * If we couldn't take the shortcut, see if we can at least kill some -- 2.14.0 -- 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