This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] PR66714 -- Re: Re: [RFC] two-phase marking in gt_cleare_cache
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Cesar Philippidis <cesar_philippidis at mentor dot com>
- Cc: Michael Matz <matz at suse dot de>, Tom de Vries <Tom_deVries at mentor dot com>, Richard Biener <richard dot guenther at gmail dot com>, "gcc-patches at gnu dot org" <gcc-patches at gnu dot org>
- Date: Fri, 24 Jul 2015 00:11:11 +0200
- Subject: Re: [patch] PR66714 -- Re: Re: [RFC] two-phase marking in gt_cleare_cache
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 20 dot 1507131504490 dot 23227 at wotan dot suse dot de> <55B10652 dot 8050304 at mentor dot com> <20150723153241 dot GD1780 at tucnak dot redhat dot com> <55B16435 dot 8080204 at mentor dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Thu, Jul 23, 2015 at 03:01:25PM -0700, Cesar Philippidis wrote:
> On 07/23/2015 08:32 AM, Jakub Jelinek wrote:
> > On Thu, Jul 23, 2015 at 08:20:50AM -0700, Cesar Philippidis wrote:
> >> The attached patch does just that; it teaches
> >> replace_block_vars_by_duplicates to replace the decls inside the
> >> value-exprs with a duplicate too. It's kind of messy though. At the
> >> moment I'm only considering VAR_DECL, PARM_DECL, RESULT_DECL, ADDR_EXPR,
> >> ARRAY_REF, COMPONENT_REF, CONVERT_EXPR, NOP_EXPR, INDIRECT_REF and
> >> MEM_REFs. I suspect that I may be missing some, but these are the only
> >> ones that were triggered gcc_unreachable during testing.
> >
> > Ugh, that looks ugly, why do we have all the tree walkers?
> > I'd unshare_expr the value expr first, you really don't want to share
> > it anyway, and then just walk_tree and find all the decls in there
> > (with *walk_subtrees on types and perhaps something else too) and for them
> > replace_by_duplicate_decl (tp, vars_map, to_context);
>
> Something like the attached patch? Why do TREE_TYPEs need special handling?
They can have decls in various places like TYPE_SIZE_UNIT, TYPE_SIZE, the
bounds of TYPE_DOMAIN etc. and I believe you generally don't want to replace
those. Plus you risk infinite recursion then (unless walk_tree_without_duplicates).
Most walk_tree callbacks just do something like
if (IS_TYPE_OR_DECL_P (*tp))
*walk_subtrees = 0;
Jakub