public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/37046]  New: Inlining produces calls which gimple_call_fndecl cannot handle correctly
@ 2008-08-07 10:11 jamborm at gcc dot gnu dot org
  2008-08-07 10:12 ` [Bug middle-end/37046] " jamborm at gcc dot gnu dot org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: jamborm at gcc dot gnu dot org @ 2008-08-07 10:11 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-09-10 10:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-07 10:11 [Bug middle-end/37046] New: Inlining produces calls which gimple_call_fndecl cannot handle correctly jamborm at gcc dot gnu dot org
2008-08-07 10:12 ` [Bug middle-end/37046] " jamborm at gcc dot gnu dot org
2008-08-07 13:16 ` rguenth at gcc dot gnu dot org
2008-08-07 15:51 ` jamborm at gcc dot gnu dot org
2008-08-07 16:01 ` rguenth at gcc dot gnu dot org
2008-08-08  7:51 ` jamborm at gcc dot gnu dot org
2008-08-10 20:28 ` [Bug middle-end/37046] [4.4 Regression] " pinskia at gcc dot gnu dot org
2008-08-10 20:45 ` rguenther at suse dot de
2008-08-22 15:06 ` rguenth at gcc dot gnu dot org
2008-09-10 10:12 ` jamborm at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).