kill_instruction() will kill an OP_CALL but only if it's a forced kill or if the corresponding function is pure. However, only functions called via a symbol pseudo are so killed. Those called via a function pointer are not because only symbol pseudos contain the function type needed to test the presence of the MOD_PURE modifier. Fix this by using the function type always available in the instruction's ::fntypes member. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> --- simplify.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/simplify.c b/simplify.c index 6caf6cbcf918..634a3ea66e91 100644 --- a/simplify.c +++ b/simplify.c @@ -351,9 +351,9 @@ int kill_insn(struct instruction *insn, int force) case OP_CALL: if (!force) { /* a "pure" function can be killed too */ - if (!(insn->func->type == PSEUDO_SYM)) - return 0; - if (!(insn->func->sym->ctype.modifiers & MOD_PURE)) + struct symbol *fntype = first_symbol(insn->fntypes); + + if (!(fntype->ctype.modifiers & MOD_PURE)) return 0; } kill_use_list(insn->arguments); -- 2.29.0