[PATCH] Keep unused local user vars at -O0 (PR debug/39474)
Richard Guenther
richard.guenther@gmail.com
Tue Mar 17 16:42:00 GMT 2009
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
>
More information about the Gcc-patches
mailing list