tree-inline.c (estimate_num_insns_1): Use declaration to discover argument types...
authorJan Hubicka <jh@suse.cz>
Mon, 28 Mar 2005 13:16:14 +0000 (15:16 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Mon, 28 Mar 2005 13:16:14 +0000 (13:16 +0000)
* tree-inline.c (estimate_num_insns_1): Use declaration to discover argument
types where possible.

From-SVN: r97132

gcc/ChangeLog
gcc/tree-inline.c

index eb471ba5190babe40b985c30df240d409a0a987b..33a60b1b93b9dc88ff823105a89f9050a8563b06 100644 (file)
@@ -1,3 +1,8 @@
+2005-03-28  Jan Hubicka  <jh@suse.cz>
+
+       * tree-inline.c (estimate_num_insns_1): Use declaration to discover argument
+       types where possible.
+
 2005-03-26  Per Bothner  <per@bothner.com>
 
        Make -f[no-]show-column also control non-cpp diagnostics.
index 6f46eed8c369fb45ac2b29698ef8c50c64937f95..0b38f08724c667ae3456ef7b13ef6e4315a4dc12 100644 (file)
@@ -1403,9 +1403,18 @@ estimate_num_insns_1 (tree *tp, int *walk_subtrees, void *data)
              break;
            }
 
-       arg = TREE_OPERAND (x, 1);
-       for (arg = TREE_OPERAND (x, 1); arg; arg = TREE_CHAIN (arg))
-         *count += estimate_move_cost (TREE_TYPE (TREE_VALUE (arg)));
+       /* 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)
+         {
+           for (arg = TREE_OPERAND (x, 1); arg; arg = TREE_CHAIN (arg))
+             *count += estimate_move_cost (TREE_TYPE (TREE_VALUE (arg)));
+         }
+       else
+         {
+           for (arg = DECL_ARGUMENTS (decl); arg; arg = TREE_CHAIN (arg))
+             *count += estimate_move_cost (TREE_TYPE (arg));
+         }
 
        *count += PARAM_VALUE (PARAM_INLINE_CALL_COST);
        break;