Use modref kills in tree-ssa-dse

Richard Biener rguenther@suse.de
Tue Nov 16 12:39:23 GMT 2021


On Tue, 16 Nov 2021, Jan Hubicka wrote:

> > 
> > Not sure, tree-ssa-dse.c doesn't seem to handle MEM_REF with offset?
> > 
> > VN has adjust_offsets_for_equal_base_address for this purpose.  I
> > agree that some common functionality like
> > 
> > bool
> > get_relative_extent_of (const ao_ref *base, const ao_ref *ref,
> >                         poly_int64 *offset);
> > 
> > that computes [offset, offset + ref->[max_]size] of REF adjusted as to
> > make ao_ref_base have the same address (or return false if not
> > possible).  Then [ base->offset, base->offset + base->max_size ]
> > can be compared against that.
> 
> OK, I will look into that.
> > > +  if (valid_ao_ref_for_dse (write)
> > > +      && operand_equal_p (write->base, ref->base, OEP_ADDRESS_OF)
> > > +      && known_eq (write->size, write->max_size)
> > > +      && normalize_ref (write, ref)
> > 
> > normalize_ref alters 'write', I think we should work on a local
> > copy here.  See live_bytes_read which takes a copy of 'use_ref'.
> 
> We never proces same write twice (get_ao_ref is always constructing
> fresh copy), so this should be safe.  Or shall I turn the write
> parameter to "ao_ref write" instead of "ao_ref *write" just to be sure
> we do not break infuture?

Yes.

Thanks,
Richard.


More information about the Gcc-patches mailing list