I would also mark DECL_IS_OPERATOR_DELETE_P the other operators delete, because of the name of the macro, but it is not important for this patch.

DCE has special code to avoid removing the LHS of malloc when it is unused. Is there something different about operator new that makes it not need the same handling?

The patch is happy to simplify malloc+delete or new+free. That makes sense to me, if someone wants to diagnose weird mixes, that's a separate work they can do later.

(Not this patch: I wonder how much speed we would lose by making gimple_call_operator_delete_p take a gimple* and check if the thing is a call, so we don't have to repeat is_gimple_call and as_a<gcall*> in half of the callers. An overload (overkill) would of course lose nothing. But, with just the gimple* version, especially if it was in a .h, I wonder if we would manage to eliminate the overhead of checking is_gimple_call when we already know it is a call)

--
Marc Glisse

Reply via email to