This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [C++] more useless stuff in expand_body


> Jan Hubicka wrote:
> >> Jan Hubicka wrote:
> >>> Hi,
> >>> this is another apparently unnecesary bit in expand_body.  I think it is
> >>> artefact from times TREE_USED was used to track down what to output.
> >>>
> >>> Bootstrapped/regtested i686-linux, OK?
> >> This was to avoid -Wunused warning about variables in multiple clones.
> >> For example, things like:
> >>
> >>   struct S {
> >>     S(int);
> >>   };
> >>
> >>   S::S(int i) {}
> >>
> >> We only want *one* warning about "i" being unused, even if we generate
> >> multiple clones of S::S.  Are you sure that can no longer occur?
> 
> > amd:~/trunk/build2/gcc # ./xgcc -B ./ -Wunused-parameter t.C -S
> > t.C:5: warning: unused parameter 'i'
> > with or without the patch.
> 
> Well, you'd have to look back at the patch that added that code to
> figure out exactly what test case was required to trigger it.  I'd not
> be surprised if you needed virtual functions, needed to actually use the
> constructor, etc.
> 
> > The hunk above won't silence the warning, since the warning is done from
> > cgraph_finalize_function that is done long time before expand_body hook
> > is called.
> 
> If you're sure it doesn't do anything, then it's OK to remove it.

I am pretty sure about this. Doing some archeology the code apparently
originated here in Nathan's patch
http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01213.html
The testcase in PR works fine for me as does the testcase, so I am going
to remove the code and in case something breaks I will move it prior
cgraph_finalize_function call.

As a next step, I would really like to remove expand_body - this
langhook is anoying since it requires cgraph to call into frontend to
call back into cgraph to compile function so things don't fit nicely to
PM nor would work for LTO.

Last remaining bit is the thunks.  I spent some time poking about it
last week trying to add some cgraph API to register thunks instead of
letting C++ frontend to do the job himself, but it is a bit involved.
Would you be happy with at least intermediate solution of replacing
expand_body hook by expand_associated_thunks hook that would be called
from PM? That way I can proceed with passmanagerizing the remaining
cgraph bits making LTO pass queue cleaner.

We will need to represent thunks in LTO in longer run making it frontend
independent, but this don't need to be done at once...

Thanks,
Honza

> 
> -- 
> Mark Mitchell
> CodeSourcery
> mark@codesourcery.com
> (650) 331-3385 x713


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]