[llvm-commits] [llvm-gcc-4.2] r53130 - /llvm-gcc-4.2/trunk/gcc/cgraphunit.c
Dale Johannesen
dalej at apple.com
Fri Jul 4 11:42:28 PDT 2008
On Jul 4, 2008, at 12:55 AM, Evan Cheng wrote:
> 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.
If debug_foo is dead, and there are no objects of type foo or foo*
(either of which would cause the type to be emitted), why would you
want to do this?
(Apple-centric view): Also, this is not a change in behavior from the
viewpoint of most users; it restores the 4.0 behavior. g++'s behavior
changed from 3.3 to 4.0, and changed back from 4.0 to 4.2; I'm not
aware of any bug reports about either change. So I don't believe this
is important to users.
>> 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.
This won't work when LTO is on, will it? You need the explicit
"used" (actually, I'm not sure whether LTO honors that, but it ought
to).
More information about the llvm-commits
mailing list