public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/40223]  New: cgraph_estimate_size_after_inlining missmatch
@ 2009-05-22 14:46 sergei_lus at yahoo dot com
  2009-05-22 18:23 ` [Bug middle-end/40223] " rguenth at gcc dot gnu dot org
  2009-06-08 15:54 ` hubicka at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: sergei_lus at yahoo dot com @ 2009-05-22 14:46 UTC (permalink / raw)
  To: gcc-bugs

It is not so much a bug report, but probably a note:

In ipa-inline.c function cgraph_estimate_size_after_inlining has the following
loop:

  for (arg = DECL_ARGUMENTS (fndecl); arg; arg = TREE_CHAIN (arg))
    call_insns += estimate_move_cost (TREE_TYPE (arg));

Should it actually be something like this: 

  for (arg = DECL_ARGUMENTS (fndecl); arg; arg = TREE_CHAIN (arg))
   if (!VOID_TYPE_P (TREE_TYPE (arg)))
    call_insns += estimate_move_cost (TREE_TYPE (arg));

fndecl usually has VOID as last tree chain member, and that adds 4 points to
cost that it is probably not intending. 
See tree-inline.c on trunk (147575)estimate_num_insns:

        /* Our cost must be kept in sync with
           cgraph_estimate_size_after_inlining that does use function
           declaration to figure out the arguments.  */
        if (decl && DECL_ARGUMENTS (decl))
          {
            tree arg;
            for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
              if (!VOID_TYPE_P (TREE_TYPE (arg)))
                cost += estimate_move_cost (TREE_TYPE (arg));
          }
...

  My code did trigger gcc_assert (size >= 0); in
cgraph_estimate_size_after_inlining which I believe might be related to the
above described.


-- 
           Summary: cgraph_estimate_size_after_inlining missmatch
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sergei_lus at yahoo dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40223


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

* [Bug middle-end/40223] cgraph_estimate_size_after_inlining missmatch
  2009-05-22 14:46 [Bug middle-end/40223] New: cgraph_estimate_size_after_inlining missmatch sergei_lus at yahoo dot com
@ 2009-05-22 18:23 ` rguenth at gcc dot gnu dot org
  2009-06-08 15:54 ` hubicka at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-05-22 18:23 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-05-22 18:23 -------
Indeed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40223


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

* [Bug middle-end/40223] cgraph_estimate_size_after_inlining missmatch
  2009-05-22 14:46 [Bug middle-end/40223] New: cgraph_estimate_size_after_inlining missmatch sergei_lus at yahoo dot com
  2009-05-22 18:23 ` [Bug middle-end/40223] " rguenth at gcc dot gnu dot org
@ 2009-06-08 15:54 ` hubicka at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: hubicka at gcc dot gnu dot org @ 2009-06-08 15:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hubicka at gcc dot gnu dot org  2009-06-08 15:54 -------
The loops should be in sync, but I am but confused here.

I originally added the code only when walking types, not actual declarations,
since in decls we don't use that VOIDtype terminator.  There was some side case
where declaration actually had VOID argument in C++, but I don't recall the
exact scenario.

There is gcc_assert (!VOID_TYPE_P (type)) in estimate_move_cost I would expect
to fire if we was ever compiling function having VOID in the parm list.

How did you fire the >= 0 assert?

Honza


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40223


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

end of thread, other threads:[~2009-06-08 15:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-05-22 14:46 [Bug middle-end/40223] New: cgraph_estimate_size_after_inlining missmatch sergei_lus at yahoo dot com
2009-05-22 18:23 ` [Bug middle-end/40223] " rguenth at gcc dot gnu dot org
2009-06-08 15:54 ` hubicka 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).