Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Joseph Myers
On Tue, 26 Jan 2021, Richard Biener wrote: > If it is an initializer from constants we gimplify to a series of > assigns it might be still useful. OTOH, I'm not sure whether > a const auto is really readonly in C or if it is safe to assume > the stack part is writable and thus casting away the co

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > On Tue, Jan 26, 2021 at 12:25:16PM +0100, Richard Biener wrote: > > On Tue, 26 Jan 2021, Jakub Jelinek wrote: > > > > > On Tue, Jan 26, 2021 at 12:16:14PM +0100, Richard Biener wrote: > > > > > + /* Unless this is called during FE folding. */ > >

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 26, 2021 at 12:25:16PM +0100, Richard Biener wrote: > On Tue, 26 Jan 2021, Jakub Jelinek wrote: > > > On Tue, Jan 26, 2021 at 12:16:14PM +0100, Richard Biener wrote: > > > > + /* Unless this is called during FE folding. */ > > > > + if (cfun > > > > + && (cfun->curr_

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > On Tue, Jan 26, 2021 at 12:16:14PM +0100, Richard Biener wrote: > > > + /* Unless this is called during FE folding. */ > > > + if (cfun > > > + && (cfun->curr_properties & (PROP_trees | PROP_rtl)) == 0 > > > > don't you want && (cfun->curr_

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 26, 2021 at 12:16:14PM +0100, Richard Biener wrote: > > + /* Unless this is called during FE folding. */ > > + if (cfun > > + && (cfun->curr_properties & (PROP_trees | PROP_rtl)) == 0 > > don't you want && (cfun->curr_properties & PROP_trees) != 0? No, PROP_trees is mis

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > On Tue, Jan 26, 2021 at 11:37:42AM +0100, Jan Hubicka wrote: > > I think it would make more sense. > > We could also simply clean it up next stage1. > > I'll rebootstrap/retest the following version then (adding PROP_rtl > just in case it would be calle

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 26, 2021 at 11:37:42AM +0100, Jan Hubicka wrote: > I think it would make more sense. > We could also simply clean it up next stage1. I'll rebootstrap/retest the following version then (adding PROP_rtl just in case it would be called during expand or later). 2021-01-26 Jakub Jelinek

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jan Hubicka
> On Tue, Jan 26, 2021 at 10:55:35AM +0100, Jan Hubicka wrote: > > > On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > > > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > > > > folding, > > > > > but we don't do that anymore because ctor_for_folding etc

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > On Tue, Jan 26, 2021 at 10:55:35AM +0100, Jan Hubicka wrote: > > > On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > > > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > > > > folding, > > > > > but we don't d

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 26, 2021 at 10:55:35AM +0100, Jan Hubicka wrote: > > On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > > > folding, > > > > but we don't do that anymore because ctor_for_folding etc. has been

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jan Hubicka
> On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > > folding, > > > but we don't do that anymore because ctor_for_folding etc. has been > > > turned into a > > > GIMPLE centric API, but as the testcase s

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > > folding, > > > but we don't do that anymore because ctor_for_folding etc. has been > > > turned into a > >

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
On Tue, Jan 26, 2021 at 10:03:16AM +0100, Richard Biener wrote: > > In 4.8 and earlier we used to fold the following to 0 during GENERIC > > folding, > > but we don't do that anymore because ctor_for_folding etc. has been turned > > into a > > GIMPLE centric API, but as the testcase shows, it is

Re: [PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Richard Biener
On Tue, 26 Jan 2021, Jakub Jelinek wrote: > Hi! > > In 4.8 and earlier we used to fold the following to 0 during GENERIC folding, > but we don't do that anymore because ctor_for_folding etc. has been turned > into a > GIMPLE centric API, but as the testcase shows, it is invoked even during > GEN

[PATCH] varpool: Restore GENERIC TREE_READONLY automatic var optimization [PR7260]

2021-01-26 Thread Jakub Jelinek via Gcc-patches
Hi! In 4.8 and earlier we used to fold the following to 0 during GENERIC folding, but we don't do that anymore because ctor_for_folding etc. has been turned into a GIMPLE centric API, but as the testcase shows, it is invoked even during GENERIC folding and there the automatic vars still should ha