We set has_volatile_ops on all(?) memory references during early
optimization because we don't have alias information. But we
do it inconsistently for loads. For example I see
D.2574_23 = *D.2573_22;
(no volatile) and
D.2565_28 ={v} tab[D.2560_27].__delta;
(volatile). Because for indirect references we also check
/* Aliasing information is missing; mark statement as
volatile so we won't optimize it out too actively. */
else if (!gimple_aliases_computed_p (cfun)
&& (flags & opf_def))
s_ann->has_volatile_ops = true;
so only add has_volatile_ops if we would create a DEF. Now the
other place is in the generic add_virtual_operand like
if (aliases == NULL)
{
if (!gimple_aliases_computed_p (cfun))
s_ann->has_volatile_ops = true;
and so also marks load. Which one is safe? I suppose it is safe
to DCE loads even without alias information? So I'd add the check
for a DEF also in the generic add_virtual_operand code.
Thanks for clarification.
Richard.