Fix gcc.c-torture/unsorted/uuarg.c failure
Jan Hubicka
jh@suse.cz
Thu Mar 24 03:30:00 GMT 2005
Hi,
this patch fixes overlook in our inlining heuristics change - for C the
number of arguments and the actual number of arguments may differ. The
inlining heuristics is driven by the declarations, while the
estimate_num_insns code is driven by call instruction resulting in
occasional cases where estimate size of function after inlining became
negative. Since I put in the assert checking this scenario in meantime,
we now get failure.
Fixed by making estimate_num_insns to use decl when possible - the other
dirrection is much more dificult as we don't have the actual call
instructions ready.
Bootstrapped/regtested i686-pc-gnu-linux, going to commit it shortly.
Honza
2005-03-24 Jan Hubicka <jh@suse.cz>
* tree-inline.c (estimate_num_insns_1): Use declaration to discover argument
types where possible.
Index: tree-inline.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-inline.c,v
retrieving revision 1.173
diff -c -3 -p -r1.173 tree-inline.c
*** tree-inline.c 22 Mar 2005 20:53:23 -0000 1.173
--- tree-inline.c 23 Mar 2005 15:50:35 -0000
*************** estimate_num_insns_1 (tree *tp, int *wal
*** 1403,1411 ****
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)));
*count += PARAM_VALUE (PARAM_INLINE_CALL_COST);
break;
--- 1403,1420 ----
break;
}
! /* 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;
More information about the Gcc-patches
mailing list