[Bug middle-end/40223] New: cgraph_estimate_size_after_inlining missmatch

sergei_lus at yahoo dot com gcc-bugzilla@gcc.gnu.org
Fri May 22 14:46:00 GMT 2009


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



More information about the Gcc-bugs mailing list