This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
On May 27, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:
> On Wed, May 27, 2009 at 6:39 PM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> On May 27, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:
>>
>>> @@ -640,6 +633,9 @@ remove_unused_locals (void)
>>> Â Âvar_ann_t ann;
>>> Â Âbitmap global_unused_vars = NULL;
>>
>>> + Âif (!optimize)
>>> + Â Âreturn;
>>> +
>>
>>> This deserves a comment. ÂAlso checks for optimize later in that
>>> function should be removed.
>>
>> *nod*
>>
>>> Ok with that change (the other patch as well).
>>
>> Thanks
In addition to the tree-inline.c patch posted before, here's the patch
I'm installing in trunk and 4.4, combining the two patches for
tree-ssa-live.c (the second reverted the first) with the suggestions
above. Tested on x86_64-linux-gnu and i686-pc-linux-gnu.
for gcc/ChangeLog
from Alexandre Oliva <aoliva@redhat.com>
* tree-ssa-live.c (remove_unused_locals): Skip when not optimizing.
Simplify other tests involving optimize.
Index: gcc/tree-ssa-live.c
===================================================================
--- gcc/tree-ssa-live.c.orig 2009-05-28 03:29:10.000000000 -0300
+++ gcc/tree-ssa-live.c 2009-05-28 03:44:46.000000000 -0300
@@ -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))
--
Alexandre Oliva, freedom fighter http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/ FSF Latin America board member
Free Software Evangelist Red Hat Brazil Compiler Engineer
- References:
- [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
- Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
- Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
- Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
- Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression
- Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression