https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93385

--- Comment #13 from Martin Jambor <jamborm at gcc dot gnu.org> ---
The assumption is that DCE will eventually remove all gimple
assignments with LHS which has no uses if gimple_has_volatile_ops
returns false for them.  I have had only a brief look at DCE today and
it seems to use gimple_has_side_effects instead, which for assignments
looks equivalent but perhaps IPA-SRA should use that for the sake of
consistency.  I thought this assumption was conservative enough, but
perhaps I am too optimistic.

Scheduling a DCE before IPA-SRA summary building would not help in the
general case because IPA-SRA is optimistic about call argument uses.
If all calculations end up being used only as a call argument and the
pass finds out in the interprocedural phase that these arguments are
going to be removed, it would then also remove the parameter in
question - and without subsequent DCE the calculations would not be
removed again.

Adding this kind of DCE to the modification phase of IPA-SRA is of
course an option - we'll have to plug it into tree-inline.c somewhere,
making it a tiny bit more complicated again though.

Reply via email to