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

Evan Cheng evan.cheng at apple.com
Fri Jul 4 00:55:15 PDT 2008


Wouldn't attribute "used" work in keeping the function from being dce?

Evan

On Jul 3, 2008, at 10:11 PM, Chris Lattner wrote:

> On Jul 3, 2008, at 8:48 PM, Eric Christopher wrote:
>>> 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.
>
> Make the function non-static.  Note that this only changes behavior
> when compiling C++, not C.  In C++ the same thing already happens for
> inline functions and many other cases.
>
> -Chris
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits




More information about the llvm-commits mailing list