This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Keep unused local user vars at -O0 (PR debug/39474)
- 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: Tue, 17 Mar 2009 17:40:43 +0100
- Subject: Re: [PATCH] Keep unused local user vars at -O0 (PR debug/39474)
- References: <20090317161120.GH4561@tyan-ft48-01.lab.bos.redhat.com>
On Tue, Mar 17, 2009 at 5:11 PM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> We IMHO shouldn't remove unused user locals, only artificial vars, when
> we are not optimizing. ?This cures one testcase in gdb testsuite.
>
> Bootstrapped/regtested on x86_64-linux, ok for trunk?
Ok.
Thanks,
Richard.
> 2009-03-17 ?Jakub Jelinek ?<jakub@redhat.com>
>
> ? ? ? ?PR debug/39474
> ? ? ? ?* tree-ssa-live.c (remove_unused_locals): Don't remove local
> ? ? ? ?unused non-artificial variables when not optimizing.
>
> --- gcc/tree-ssa-live.c.jj ? ? ?2009-03-02 09:45:47.000000000 +0100
> +++ gcc/tree-ssa-live.c 2009-03-17 10:29:29.000000000 +0100
> @@ -740,7 +740,8 @@ remove_unused_locals (void)
>
> ? ? ? if (TREE_CODE (var) != FUNCTION_DECL
> ? ? ? ? ?&& (!(ann = var_ann (var))
> - ? ? ? ? ? ? || !ann->used))
> + ? ? ? ? ? ? || !ann->used)
> + ? ? ? ? && (optimize || DECL_ARTIFICIAL (var)))
> ? ? ? ?{
> ? ? ? ? ?if (is_global_var (var))
> ? ? ? ? ? ?{
> @@ -781,8 +782,7 @@ remove_unused_locals (void)
>
> ? ? ? ? ?if (TREE_CODE (var) == VAR_DECL
> ? ? ? ? ? ? ?&& is_global_var (var)
> - ? ? ? ? ? ? && bitmap_bit_p (global_unused_vars, DECL_UID (var))
> - ? ? ? ? ? ? && (optimize || DECL_ARTIFICIAL (var)))
> + ? ? ? ? ? ? && bitmap_bit_p (global_unused_vars, DECL_UID (var)))
> ? ? ? ? ? ?*cell = TREE_CHAIN (*cell);
> ? ? ? ? ?else
> ? ? ? ? ? ?cell = &TREE_CHAIN (*cell);
>
> ? ? ? ?Jakub
>