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: [patch] Fix inlining glitch


> On Sun, Jul 24, 2011 at 7:12 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
> > Hi,
> >
> > we sometimes get messages like this in Ada:
> >
> > prime-mc2-other.adb: In function 'PRIME.MC2.OTHER.DO_SOMETHING':
> > prime-mc2.adb:2:4: warning: inlining failed in call
> > to 'PRIME.MC2.GET_INPUT_VALUE.PART': non-call exception handling mismatch
> > [-Winline]
> > prime-mc2-other.adb:3:4: warning: called from here [-Winline]
> >
> > Since this is for a pure Ada program, it's unexpected. ?This stems from virtual
> > cloning: cgraph_create_virtual_clone creates the virtual clone and does:
> >
> > ?DECL_STRUCT_FUNCTION (new_decl) = NULL;
> >
> > so the can_throw_non_call_exceptions flag isn't preserved and can_inline_edge_p
> > is fooled into thinking that it cannot inline.
> >
> > It's probably better not to fiddle with virtual cloning so the attached patch
> > teaches can_inline_edge_p to look into DECL_STRUCT_FUNCTION of the original
> > nodes if it is dealing with virtual clones.
> >
> > Tested on i586-suse-linux, OK for the mainline?
> 
> Doesn't cgraph_function_or_thunk_node already deal with this?  Honza?

No, the problem here is deciding whether we can inline a clone.
We look into DECL_STRUCT_FUNCTION that we can't.  The real fix is one commented in:

  /* Don't inline if the callee can throw non-call exceptions but the
     caller cannot.
     FIXME: this is obviously wrong for LTO where STRUCT_FUNCTION is missing.
     Move the flag into cgraph node or mirror it in the inline summary.  */

I plan to look into this before next release.  I would, for sure, welcome Eric beating me. If he don't have
time to do so, I think the patch is OK as it is, since it improves the situation despite the fact that
it won't fix the same problem with WPA.

Honza
> 
> Richard.
> 
> >
> > 2011-07-24 ?Eric Botcazou ?<ebotcazou@adacore.com>
> >
> > ? ? ? ?* ipa-inline.c (can_inline_edge_p): Look into DECL_STRUCT_FUNCTION of
> > ? ? ? ?original nodes if we are dealing with virtual clones.
> >
> >
> > --
> > Eric Botcazou
> >


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