This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Keep unused local user vars at -O0 (PR debug/39474)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 17 Mar 2009 17:11:20 +0100
- Subject: [PATCH] Keep unused local user vars at -O0 (PR debug/39474)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
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?
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