diff options
author | Jan Hubicka <hubicka@gcc.gnu.org> | 2011-01-26 14:06:20 +0000 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2011-01-26 14:06:20 +0000 |
commit | 61e03ffc6b8284abe34837fc85a82566ee4552ee (patch) | |
tree | 4e831ce4ac2924d53233e6215470e4dbd88eea9a /gcc/ipa-cp.c | |
parent | 980ca89173da230e449a8e8017f0b2c2b46a374a (diff) | |
download | gcc-61e03ffc6b8284abe34837fc85a82566ee4552ee.zip gcc-61e03ffc6b8284abe34837fc85a82566ee4552ee.tar.gz gcc-61e03ffc6b8284abe34837fc85a82566ee4552ee.tar.bz2 |
re PR tree-optimization/47237 (builtin_apply_args broken WRT local ABI changes.)
PR target/47237
* cgraph.h (cgraph_local_info): New field can_change_signature.
* ipa-cp.c (ipcp_update_callgraph): Only compute args_to_skip if callee
signature can change.
(ipcp_estimate_growth): Call sequence simplify only if calle signature
can change.
(ipcp_insert_stage): Only compute args_to_skip if signature can change.
(cgraph_function_versioning): We can not change signature of functions
that don't allow that.
* lto-cgraph.c (lto_output_node): Stream local.can_change_signature.
(lto_input_node): Likewise.
* ipa-inline.c (compute_inline_parameters): Compute local.can_change_signature.
* ipa-split.c (visit_bb): Never split away APPLY_ARGS.
* tree-sra.c (ipa_sra_preliminary_function_checks): Give up on functions
that can not change signature.
* i386.c (ix86_function_regparm, ix86_function_sseregparm,
init_cumulative_args): Do not use local calling conventions for functions
that can not change signature.
From-SVN: r169290
Diffstat (limited to 'gcc/ipa-cp.c')
-rw-r--r-- | gcc/ipa-cp.c | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c index ce6fd59..b06238d 100644 --- a/gcc/ipa-cp.c +++ b/gcc/ipa-cp.c @@ -1040,25 +1040,29 @@ ipcp_update_callgraph (void) for (node = cgraph_nodes; node; node = node->next) if (node->analyzed && ipcp_node_is_clone (node)) { - bitmap args_to_skip = BITMAP_ALLOC (NULL); + bitmap args_to_skip = NULL; struct cgraph_node *orig_node = ipcp_get_orig_node (node); struct ipa_node_params *info = IPA_NODE_REF (orig_node); int i, count = ipa_get_param_count (info); struct cgraph_edge *cs, *next; - for (i = 0; i < count; i++) + if (node->local.can_change_signature) { - struct ipcp_lattice *lat = ipcp_get_lattice (info, i); - - /* We can proactively remove obviously unused arguments. */ - if (!ipa_is_param_used (info, i)) + args_to_skip = BITMAP_ALLOC (NULL); + for (i = 0; i < count; i++) { - bitmap_set_bit (args_to_skip, i); - continue; - } + struct ipcp_lattice *lat = ipcp_get_lattice (info, i); + + /* We can proactively remove obviously unused arguments. */ + if (!ipa_is_param_used (info, i)) + { + bitmap_set_bit (args_to_skip, i); + continue; + } - if (lat->type == IPA_CONST_VALUE) - bitmap_set_bit (args_to_skip, i); + if (lat->type == IPA_CONST_VALUE) + bitmap_set_bit (args_to_skip, i); + } } for (cs = node->callers; cs; cs = next) { @@ -1130,17 +1134,18 @@ ipcp_estimate_growth (struct cgraph_node *node) info = IPA_NODE_REF (node); count = ipa_get_param_count (info); - for (i = 0; i < count; i++) - { - struct ipcp_lattice *lat = ipcp_get_lattice (info, i); + if (node->local.can_change_signature) + for (i = 0; i < count; i++) + { + struct ipcp_lattice *lat = ipcp_get_lattice (info, i); - /* We can proactively remove obviously unused arguments. */ - if (!ipa_is_param_used (info, i)) - removable_args++; + /* We can proactively remove obviously unused arguments. */ + if (!ipa_is_param_used (info, i)) + removable_args++; - if (lat->type == IPA_CONST_VALUE) - removable_args++; - } + if (lat->type == IPA_CONST_VALUE) + removable_args++; + } /* We make just very simple estimate of savings for removal of operand from call site. Precise cost is dificult to get, as our size metric counts @@ -1386,16 +1391,21 @@ ipcp_insert_stage (void) count = ipa_get_param_count (info); replace_trees = VEC_alloc (ipa_replace_map_p, gc, 1); - args_to_skip = BITMAP_GGC_ALLOC (); + + if (node->local.can_change_signature) + args_to_skip = BITMAP_GGC_ALLOC (); + else + args_to_skip = NULL; for (i = 0; i < count; i++) { struct ipcp_lattice *lat = ipcp_get_lattice (info, i); parm_tree = ipa_get_param (info, i); /* We can proactively remove obviously unused arguments. */ - if (!ipa_is_param_used (info, i)) + if (!ipa_is_param_used (info, i)) { - bitmap_set_bit (args_to_skip, i); + if (args_to_skip) + bitmap_set_bit (args_to_skip, i); continue; } @@ -1404,7 +1414,8 @@ ipcp_insert_stage (void) replace_param = ipcp_create_replace_map (parm_tree, lat); VEC_safe_push (ipa_replace_map_p, gc, replace_trees, replace_param); - bitmap_set_bit (args_to_skip, i); + if (args_to_skip) + bitmap_set_bit (args_to_skip, i); } } |