This is the mail archive of the
mailing list for the GCC project.
Re: Fix removal of ctors/dtors
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 2 Nov 2010 03:29:06 +0100
- Subject: Re: Fix removal of ctors/dtors
- References: <20101026141604.GD20390@kam.mff.cuni.cz> <20101101144837.GA16393@virgil.arch.suse.de>
> On Tue, Oct 26, 2010 at 04:16:04PM +0200, Jan Hubicka wrote:
> > Finally both inliner and ipa-cp confuse handling of functions with
> > address taken. ipa-cp is considering functions with address taken
> > to be cloning candidates. This is wrong. We should clone only when
> > we think original function is not called at all but we can't say for
> > sure since it is externally visible. Clonning is of course
> > possible, but current impementation leads to wrong code when
> > updating call sites of calls promoted to be direct.
> We have had similar issues before but so far managed to get around
> them without such a big hammer. Do you have a testcase that will fail
> if I remove the ipa-cp hunk?
The problem I ran into was that ipa-cp tried to propagate across function with
adress taken without clonning it. This is obviously wrong, so the first part
of ipa-cp change (reducing non-clonning propagation to local function only) is
IMO only correct way.
We can support clonning functions with address taken, but I am not sure how
desriable it is: I think the idea of current ipa-cp implementation is to clone
only when all calls in current unit have same constant operand. Taking address
imply an indirect call where we know nothing. So clonning functions with
address taken is more work for the clonning pass we don't have (yet:).
You might try to revert the second change and ensure that we do update edges
correctly when ipa-cp promote indirect call to dirrect call.