[llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c

Eric Christopher echristo at apple.com
Thu Jul 3 20:48:31 PDT 2008


On Jul 3, 2008, at 7:58 PM, Chris Lattner wrote:

>
> On Jul 3, 2008, at 5:28 PM, Dale Johannesen wrote:
>
>> Author: johannes
>> Date: Thu Jul  3 19:28:07 2008
>> New Revision: 53130
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=53130&view=rev
>> Log:
>> Do not emit unreferenced static functions at -O0.
>> This is the gcc-4.0 behavior, changed deliberately
>> in gcc-4.2, see PR 24561.  After discussion Chris,
>> Evan and I agreed the 4.0 behavior is better so
>> we're going back to that.
>>
>> Note this applies to C++, not C by default, because
>> you also need -funit-at-a-time (default in C++ only).
>
> FWIW, the major issue here is that emitting dead static functions at -
> O0 -g pulls in debug info for them.  For a simple file that includes
> something like <iostream> this is majority of the debug info,
> regardless of whether streams are used or not.
>
> Thanks for tracking this down Dale!

I don't know that I agree with this. For example:

struct foo
{
   ...
}

static void debug_foo (struct foo)
{
     printf(...)
     ...
}

You've just made it impossible to print out (without additional work)  
struct foo from within gdb if foo is only used in one file and  
therefore doesn't need a non-static debug routine. Worse, this isn't  
obvious - especially at O0.

-eric



More information about the llvm-commits mailing list