has_volatile_ops and early optimization w/o alias information
Richard Guenther
rguenther@suse.de
Mon Sep 3 15:55:00 GMT 2007
On Mon, 3 Sep 2007, Richard Guenther wrote:
>
> 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.
Which leads to the following patch. Bootstrapped and tested on
x86_64-unknown-linux-gnu.
Richard.
2007-09-03 Richard Guenther <rguenther@suse.de>
* tree-ssa-operands.c (add_virtual_operand): Only mark
stores as has_volatile_ops if alias information is not available.
Index: tree-ssa-operands.c
===================================================================
*** tree-ssa-operands.c (revision 128037)
--- tree-ssa-operands.c (working copy)
*************** add_virtual_operand (tree var, stmt_ann_
*** 1494,1500 ****
if (aliases == NULL)
{
! if (!gimple_aliases_computed_p (cfun))
s_ann->has_volatile_ops = true;
/* The variable is not aliased or it is an alias tag. */
--- 1494,1501 ----
if (aliases == NULL)
{
! if (!gimple_aliases_computed_p (cfun)
! && (flags & opf_def))
s_ann->has_volatile_ops = true;
/* The variable is not aliased or it is an alias tag. */
More information about the Gcc-patches
mailing list