This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Fix remove_unused_locals (PR tree-optimization/33645)
- From: "Richard Guenther" <richard dot guenther at gmail dot com>
- To: "Jakub Jelinek" <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 11 Oct 2007 15:43:44 +0200
- Subject: Re: [PATCH] Fix remove_unused_locals (PR tree-optimization/33645)
- References: <20071011133539.GA2625@devserv.devel.redhat.com>
On 10/11/07, Jakub Jelinek <firstname.lastname@example.org> wrote:
> As the first testcase below shows, remove_unused_locals can purge
> global (static) vars from unexpanded_var_list, even when they are actually
> used by some used static var initializer. The testcase doesn't fail
> with -funit-at-a-time, because build_cgraph_edges already added the vars
> into varpool and so even when they are not present in unexpanded_var_list,
> they will be emitted if they are actually used.
> Simply not purging is_global_var vars from unexpanded_var_list would cause
> regression on attached pr33645-3.c, so this patch calls mark_all_vars_used
> on DECL_INITIAL of in unexpanded_var_list present is_global_vars that are
> known to be used (and does that recursively for newly such discovered vars).
> Regtested on x86_64-linux, ok for trunk?
This is ok.
> 2007-10-11 Jakub Jelinek <email@example.com>
> PR tree-optimization/33645
> * tree-ssa-live.c (mark_all_vars_used): Add data argument,
> pass it to walk_tree.
> (mark_all_vars_used_1): Pass data through to mark_all_vars_used.
> When calling set_is_used on a VAR_DECL, if data is not NULL and
> its DECL_UID is in the bitmap, call mark_all_vars_used on its
> DECL_INITIAL after clearing the bit in bitmap.
> (remove_unused_locals): Adjust mark_all_vars_used callers.
> Instead of removing unused global vars from unexpanded_var_list
> immediately record them in bitmap, call mark_all_vars_used on
> all used global vars from unexpanded_var_list and only purge
> global vars that weren't found used even during that step.
> * gcc.dg/pr33645-1.c: New test.
> * gcc.dg/pr33645-2.c: New test.
> * gcc.dg/pr33645-3.c: New test.