This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/37046] New: Inlining produces calls which gimple_call_fndecl cannot handle correctly
- From: "jamborm at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 7 Aug 2008 10:09:51 -0000
- Subject: [Bug middle-end/37046] New: Inlining produces calls which gimple_call_fndecl cannot handle correctly
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
In the following example, the fucntion hooray() does not get inlined,
even though it could.
#include <stdlib.h>
#include <stdio.h>
static __attribute__((always_inline)) void hooray ()
{
printf ("hooray\n");
}
static __attribute__((always_inline)) void hiphip (void (*f)())
{
printf ("hip hip\n");
f ();
}
int main (int argc, int *argv[])
{
hiphip (hooray);
return 0;
}
int d()
{
hiphip (hooray);
return 86;
}
The reasons are I believe a bit more grave than the fact that this
(mis)use of anlways_inline does not work. When tree-inline.c produces
an inlined copy of hiphip() it remaps the destination of the call to f
in remap_gimple_stmt() to call hooray. However, the new call
statement has this form:
call<addr_expr<function_decl>>
which is a form that gimple_call_fndecl() cannot cope with. The
consequence is that rebuild_cgraph_edges() sees a call with an
unretrievable declaration and does not build a call graph edge for it.
Therefore, when early inlining inlines hiphip into its callers, there
is no call graph edge for main->hooray (or d->hooray) and so these
call sites are not even considered when doing regular inlining, let
alone always_inlining.
--
Summary: Inlining produces calls which gimple_call_fndecl cannot
handle correctly
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
AssignedTo: jamborm at gcc dot gnu dot org
ReportedBy: jamborm at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37046