backport: [multiple changes]
2010-02-08 Richard Guenther <rguenther@suse.de> PR middle-end/42995 * tree-inline.c (estimate_move_cost): Assert we are not called with a void type. (estimate_num_insns): Do not count the terminating void_type_node of a function argument type list. Backport from mainline: 2010-01-06 Richard Guenther <rguenther@suse.de> * ipa-inline.c (cgraph_decide_inlining_incrementally): Do not inline regular functions into always-inline functions. 2010-01-05 Martin Jambor <mjambor@suse.cz> PR tree-optimization/42462 * ipa-inline.c (compute_inline_parameters): Pass node->decl instead of current_function_decl to helper functions and macros. * gcc.dg/tree-ssa/inline-4.c: New testcase. * gcc.dg/Wunreachable-2.c: Remove. From-SVN: r156601
This commit is contained in:
parent
2e4d36b06c
commit
4bfb83866d
|
@ -1,3 +1,23 @@
|
|||
2010-02-08 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR middle-end/42995
|
||||
* tree-inline.c (estimate_move_cost): Assert we are not called
|
||||
with a void type.
|
||||
(estimate_num_insns): Do not count the terminating void_type_node
|
||||
of a function argument type list.
|
||||
|
||||
Backport from mainline:
|
||||
2010-01-06 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
* ipa-inline.c (cgraph_decide_inlining_incrementally): Do
|
||||
not inline regular functions into always-inline functions.
|
||||
|
||||
2010-01-05 Martin Jambor <mjambor@suse.cz>
|
||||
|
||||
PR tree-optimization/42462
|
||||
* ipa-inline.c (compute_inline_parameters): Pass node->decl instead of
|
||||
current_function_decl to helper functions and macros.
|
||||
|
||||
2010-02-04 Richard Guenther <rguenther@suse.de>
|
||||
|
||||
PR rtl-optimization/42952
|
||||
|
|
|
@ -1418,7 +1418,10 @@ cgraph_decide_inlining_incrementally (struct cgraph_node *node,
|
|||
}
|
||||
|
||||
/* Now do the automatic inlining. */
|
||||
if (mode != INLINE_ALL && mode != INLINE_ALWAYS_INLINE)
|
||||
if (mode != INLINE_ALL && mode != INLINE_ALWAYS_INLINE
|
||||
/* Never inline regular functions into always-inline functions
|
||||
during incremental inlining. */
|
||||
&& !node->local.disregard_inline_limits)
|
||||
for (e = node->callees; e; e = e->next_callee)
|
||||
{
|
||||
if (!e->callee->local.inlinable
|
||||
|
@ -1606,17 +1609,17 @@ compute_inline_parameters (struct cgraph_node *node)
|
|||
node->global.stack_frame_offset = 0;
|
||||
|
||||
/* Can this function be inlined at all? */
|
||||
node->local.inlinable = tree_inlinable_function_p (current_function_decl);
|
||||
node->local.inlinable = tree_inlinable_function_p (node->decl);
|
||||
|
||||
/* Estimate the number of instructions for this function.
|
||||
??? At -O0 we don't use this information except for the dumps, and
|
||||
even then only for always_inline functions. But disabling this
|
||||
causes ICEs in the inline heuristics... */
|
||||
inline_summary (node)->self_insns
|
||||
= estimate_num_insns_fn (current_function_decl, &eni_inlining_weights);
|
||||
= estimate_num_insns_fn (node->decl, &eni_inlining_weights);
|
||||
if (node->local.inlinable && !node->local.disregard_inline_limits)
|
||||
node->local.disregard_inline_limits
|
||||
= DECL_DISREGARD_INLINE_LIMITS (current_function_decl);
|
||||
= DECL_DISREGARD_INLINE_LIMITS (node->decl);
|
||||
|
||||
/* Inlining characteristics are maintained by the cgraph_mark_inline. */
|
||||
node->global.insns = inline_summary (node)->self_insns;
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -Wunreachable-code" } */
|
||||
|
||||
extern int foo (const char *);
|
||||
extern void baz (void);
|
||||
const char *a[] = { "one", "two" };
|
||||
|
||||
void bar (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
if (! foo (a[i]))
|
||||
return;
|
||||
|
||||
baz (); /* { dg-bogus "will never be executed" } */
|
||||
baz ();
|
||||
baz ();
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/* { dg-do compile } */
|
||||
/* { dg-options "-O2 -fdump-tree-einline2" } */
|
||||
|
||||
extern int rand(void);
|
||||
|
||||
int get_data_for (int id)
|
||||
{
|
||||
return rand();
|
||||
}
|
||||
|
||||
int my_id;
|
||||
|
||||
int main()
|
||||
{
|
||||
int res = get_data_for (my_id);
|
||||
switch (res)
|
||||
{
|
||||
case 0:
|
||||
return 666;
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
/* { dg-final { scan-tree-dump "Inlining get_data_for into main" "einline2" } } */
|
||||
/* { dg-final { cleanup-tree-dump "einline2" } } */
|
|
@ -2729,6 +2729,8 @@ estimate_move_cost (tree type)
|
|||
{
|
||||
HOST_WIDE_INT size;
|
||||
|
||||
gcc_assert (!VOID_TYPE_P (type));
|
||||
|
||||
size = int_size_in_bytes (type);
|
||||
|
||||
if (size < 0 || size > MOVE_MAX_PIECES * MOVE_RATIO (!optimize_size))
|
||||
|
@ -2980,7 +2982,8 @@ estimate_num_insns (gimple stmt, eni_weights *weights)
|
|||
{
|
||||
tree t;
|
||||
for (t = TYPE_ARG_TYPES (funtype); t; t = TREE_CHAIN (t))
|
||||
cost += estimate_move_cost (TREE_VALUE (t));
|
||||
if (!VOID_TYPE_P (TREE_VALUE (t)))
|
||||
cost += estimate_move_cost (TREE_VALUE (t));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue