From fe5c69b7c86109b2d84133242b4a413add14f4f5 Mon Sep 17 00:00:00 2001 From: aoliva Date: Thu, 28 May 2009 06:49:37 +0000 Subject: * tree-ssa-live.c (remove_unused_locals): Skip when not optimizing. Simplify other tests involving optimize. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147939 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/tree-ssa-live.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-live.c') diff --git a/gcc/tree-ssa-live.c b/gcc/tree-ssa-live.c index 3c317661388..a02b1c5209f 100644 --- a/gcc/tree-ssa-live.c +++ b/gcc/tree-ssa-live.c @@ -639,6 +639,12 @@ remove_unused_locals (void) var_ann_t ann; bitmap global_unused_vars = NULL; + /* Removing declarations from lexical blocks when not optimizing is + not only a waste of time, it actually causes differences in stack + layout. */ + if (!optimize) + return; + mark_scope_block_unused (DECL_INITIAL (current_function_decl)); /* Assume all locals are unused. */ @@ -701,8 +707,7 @@ remove_unused_locals (void) if (TREE_CODE (var) != FUNCTION_DECL && (!(ann = var_ann (var)) - || !ann->used) - && (optimize || DECL_ARTIFICIAL (var))) + || !ann->used)) { if (is_global_var (var)) { @@ -761,8 +766,7 @@ remove_unused_locals (void) && TREE_CODE (t) != PARM_DECL && TREE_CODE (t) != RESULT_DECL && !(ann = var_ann (t))->used - && !TREE_ADDRESSABLE (t) - && (optimize || DECL_ARTIFICIAL (t))) + && !TREE_ADDRESSABLE (t)) remove_referenced_var (t); remove_unused_scope_block_p (DECL_INITIAL (current_function_decl)); if (dump_file && (dump_flags & TDF_DETAILS)) -- cgit v1.2.1