> On 12/2/20 4:25 PM, Martin Jambor wrote: > > Hi, > > > > On Wed, Dec 02 2020, Jan Hubicka wrote: > > > > We create an IPA SRA (which has DECL_IS_MALLOC set to false), but later > > > > IPA pure const propagates malloc attributes. I think we should not set > > > > it for a void returning functions. > > > > > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > > > > > > > Ready to be installed? > > > > Thanks, > > > > Martin > > > > > > > > gcc/ChangeLog: > > > > > > > > PR ipa/98075 > > > > * cgraph.c (cgraph_node::dump): Dump decl_is_malloc flag. > > > > * ipa-pure-const.c (propagate_malloc): Do not set malloc > > > > attribute for void functions. > > > > > > This is OK, extra credit would be for not collecting state here. I plan > > > to avoid stremaing useless pure-const summaries (to fight memory > > > fragmentation at WPA time) so it would be nice to have an easy way to say > > > that > > > summary is not interesting. > > > > If I understood Martin's description well, it is an IPA-SRA created > > clone that is a void function, not the original. > > Yes. > > > So it is not known > > that the information is useless until the WPA stage. > > Well, we have a code in ipa_param_adjustments::adjust_decl (tree orig_decl) > where we properly not set DECL_IS_MALLOC. > But later than the info is propagated in IPA pure const. That's why the patch > was needed. > > > > > Or do I misunderstand the issue? > > Is it explained now? Yep, it looks fine. We have number of other attriutes that are about return values. It is bit inconsistent that we treat DECL_IS_MALLOC but do not seem to remove others, but I guess it is all harmless - there is no need to query those attr on void functions.
Honza > > Thanks, > Martin > > > > > Thanks, > > > > Martin > > >