Re: Use modref summary to DSE calls to non-pure functions

2021-11-12 Thread Richard Biener via Gcc-patches
On Fri, Nov 12, 2021 at 12:39 PM Jan Hubicka wrote: > > Hi, > this is updated patch. It moves the summary walk checking if we can > possibly suceed on dse to summary->finalize member function so it is done > once per summary and refactors dse_optimize_call to be called from > dse_optimize_stmt

Re: Use modref summary to DSE calls to non-pure functions

2021-11-12 Thread Jan Hubicka via Gcc-patches
Hi, this is updated patch. It moves the summary walk checking if we can possibly suceed on dse to summary->finalize member function so it is done once per summary and refactors dse_optimize_call to be called from dse_optimize_stmt after early checks. I did not try to handle the special case of

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Jan Hubicka via Gcc-patches
> > Hmm, I could try to do this, but possibly incrementally? > > You mean handle a argument specially for unknown param offset? > Yeah, I guess so. I think it is also pointer that was allocated and is going to be freed... > > > Basically I want to have > > > > foo () > > decl = {} > > > > To

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Richard Biener via Gcc-patches
On Thu, Nov 11, 2021 at 1:42 PM Jan Hubicka wrote: > > Hi, > > > > No, I think if it turns out useful then we want a way to have such ref > > represented by an ao_ref. Note that when we come from a > > ref tree we know handled-components only will increase offset, > > only the base MEM_REF can

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Jan Hubicka via Gcc-patches
Hi, > > No, I think if it turns out useful then we want a way to have such ref > represented by an ao_ref. Note that when we come from a > ref tree we know handled-components only will increase offset, > only the base MEM_REF can contain a pointer subtraction (but > the result of that is the

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Richard Biener via Gcc-patches
On Thu, Nov 11, 2021 at 1:07 PM Jan Hubicka wrote: > > > > + /* Unlike alias oracle we can not skip subtrees based on TBAA check. > > > + Count the size of the whole tree to verify that we will not need > > > too many > > > + tests. */ > > > + FOR_EACH_VEC_SAFE_ELT

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Jan Hubicka via Gcc-patches
> > + /* Unlike alias oracle we can not skip subtrees based on TBAA check. > > + Count the size of the whole tree to verify that we will not need too > > many > > + tests. */ > > + FOR_EACH_VEC_SAFE_ELT (summary->stores->bases, i, base_node) > > +FOR_EACH_VEC_SAFE_ELT

Re: Use modref summary to DSE calls to non-pure functions

2021-11-11 Thread Richard Biener via Gcc-patches
On Wed, Nov 10, 2021 at 1:43 PM Jan Hubicka via Gcc-patches wrote: > > Hi, > this patch implements DSE using modref summaries: if function has no side > effects > besides storing to memory pointed to by its argument and if we can prove > those stores > to be dead, we can optimize out. So we

Use modref summary to DSE calls to non-pure functions

2021-11-10 Thread Jan Hubicka via Gcc-patches
Hi, this patch implements DSE using modref summaries: if function has no side effects besides storing to memory pointed to by its argument and if we can prove those stores to be dead, we can optimize out. So we handle for example: volatile int *ptr; struct a { int a,b,c; } a;