backport: re PR middle-end/53136 (Use after free in ipa_make_edge_direct_to_target, cxx_printable_name_internal problem)
Backport from mainline 2012-04-30 Uros Bizjak <ubizjak@gmail.com> PR middle-end/53136 * ipa-prop.c (ipa_print_node_jump_functions): Wrap multiple calls to cgraph_node_name in xstrdup. (ipa_make_edge_direct_to_target): Ditto. * tree-sra.c (convert_callers_for_node): Ditto. * lto-symtab.c (lto_cgraph_replace_node): Ditto. * ipa-cp.c (perhaps_add_new_callers): Ditto. * cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Ditto. (cgraph_materialize_all_clones): Ditto. * ipa-inline.c (report_inline_failed_reason): Ditto. (want_early_inline_function_p): Ditto. (edge_badness): Ditto. (update_edge_key): Ditto. (flatten_function): Ditto. (ipa_inline): Ditto. (inline_always_inline_functions): Ditto. (early_inline_small_functions): Ditto. From-SVN: r187011
This commit is contained in:
parent
c6b48a6d08
commit
1e85166ca4
|
@ -1,3 +1,26 @@
|
|||
2012-05-01 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
Backport from mainline
|
||||
2012-04-30 Uros Bizjak <ubizjak@gmail.com>
|
||||
|
||||
PR middle-end/53136
|
||||
* ipa-prop.c (ipa_print_node_jump_functions): Wrap multiple
|
||||
calls to cgraph_node_name in xstrdup.
|
||||
(ipa_make_edge_direct_to_target): Ditto.
|
||||
* tree-sra.c (convert_callers_for_node): Ditto.
|
||||
* lto-symtab.c (lto_cgraph_replace_node): Ditto.
|
||||
* ipa-cp.c (perhaps_add_new_callers): Ditto.
|
||||
* cgraphunit.c (cgraph_redirect_edge_call_stmt_to_callee): Ditto.
|
||||
(cgraph_materialize_all_clones): Ditto.
|
||||
* ipa-inline.c (report_inline_failed_reason): Ditto.
|
||||
(want_early_inline_function_p): Ditto.
|
||||
(edge_badness): Ditto.
|
||||
(update_edge_key): Ditto.
|
||||
(flatten_function): Ditto.
|
||||
(ipa_inline): Ditto.
|
||||
(inline_always_inline_functions): Ditto.
|
||||
(early_inline_small_functions): Ditto.
|
||||
|
||||
2012-04-30 Andreas Tobler <andreast@fgznet.ch>
|
||||
|
||||
Backport from mainline
|
||||
|
|
|
@ -2490,8 +2490,8 @@ cgraph_redirect_edge_call_stmt_to_callee (struct cgraph_edge *e)
|
|||
if (cgraph_dump_file)
|
||||
{
|
||||
fprintf (cgraph_dump_file, "updating call of %s/%i -> %s/%i: ",
|
||||
cgraph_node_name (e->caller), e->caller->uid,
|
||||
cgraph_node_name (e->callee), e->callee->uid);
|
||||
xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
|
||||
xstrdup (cgraph_node_name (e->callee)), e->callee->uid);
|
||||
print_gimple_stmt (cgraph_dump_file, e->call_stmt, 0, dump_flags);
|
||||
if (e->callee->clone.combined_args_to_skip)
|
||||
{
|
||||
|
@ -2577,8 +2577,8 @@ cgraph_materialize_all_clones (void)
|
|||
if (cgraph_dump_file)
|
||||
{
|
||||
fprintf (cgraph_dump_file, "cloning %s to %s\n",
|
||||
cgraph_node_name (node->clone_of),
|
||||
cgraph_node_name (node));
|
||||
xstrdup (cgraph_node_name (node->clone_of)),
|
||||
xstrdup (cgraph_node_name (node)));
|
||||
if (node->clone.tree_map)
|
||||
{
|
||||
unsigned int i;
|
||||
|
@ -2591,9 +2591,11 @@ cgraph_materialize_all_clones (void)
|
|||
replace_info = VEC_index (ipa_replace_map_p,
|
||||
node->clone.tree_map,
|
||||
i);
|
||||
print_generic_expr (cgraph_dump_file, replace_info->old_tree, 0);
|
||||
print_generic_expr (cgraph_dump_file,
|
||||
replace_info->old_tree, 0);
|
||||
fprintf (cgraph_dump_file, " -> ");
|
||||
print_generic_expr (cgraph_dump_file, replace_info->new_tree, 0);
|
||||
print_generic_expr (cgraph_dump_file,
|
||||
replace_info->new_tree, 0);
|
||||
fprintf (cgraph_dump_file, "%s%s;",
|
||||
replace_info->replace_p ? "(replace)":"",
|
||||
replace_info->ref_p ? "(ref)":"");
|
||||
|
@ -2603,12 +2605,15 @@ cgraph_materialize_all_clones (void)
|
|||
if (node->clone.args_to_skip)
|
||||
{
|
||||
fprintf (cgraph_dump_file, " args_to_skip: ");
|
||||
dump_bitmap (cgraph_dump_file, node->clone.args_to_skip);
|
||||
dump_bitmap (cgraph_dump_file,
|
||||
node->clone.args_to_skip);
|
||||
}
|
||||
if (node->clone.args_to_skip)
|
||||
{
|
||||
fprintf (cgraph_dump_file, " combined_args_to_skip:");
|
||||
dump_bitmap (cgraph_dump_file, node->clone.combined_args_to_skip);
|
||||
fprintf (cgraph_dump_file,
|
||||
" combined_args_to_skip:");
|
||||
dump_bitmap (cgraph_dump_file,
|
||||
node->clone.combined_args_to_skip);
|
||||
}
|
||||
}
|
||||
cgraph_materialize_clone (node);
|
||||
|
|
|
@ -2180,8 +2180,9 @@ perhaps_add_new_callers (struct cgraph_node *node, struct ipcp_value *val)
|
|||
if (dump_file)
|
||||
fprintf (dump_file, " - adding an extra caller %s/%i"
|
||||
" of %s/%i\n",
|
||||
cgraph_node_name (cs->caller), cs->caller->uid,
|
||||
cgraph_node_name (val->spec_node),
|
||||
xstrdup (cgraph_node_name (cs->caller)),
|
||||
cs->caller->uid,
|
||||
xstrdup (cgraph_node_name (val->spec_node)),
|
||||
val->spec_node->uid);
|
||||
|
||||
cgraph_redirect_edge_callee (cs, val->spec_node);
|
||||
|
|
|
@ -220,8 +220,8 @@ report_inline_failed_reason (struct cgraph_edge *e)
|
|||
if (dump_file)
|
||||
{
|
||||
fprintf (dump_file, " not inlinable: %s/%i -> %s/%i, %s\n",
|
||||
cgraph_node_name (e->caller), e->caller->uid,
|
||||
cgraph_node_name (e->callee), e->callee->uid,
|
||||
xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
|
||||
xstrdup (cgraph_node_name (e->callee)), e->callee->uid,
|
||||
cgraph_inline_failed_string (e->inline_failed));
|
||||
}
|
||||
}
|
||||
|
@ -423,8 +423,8 @@ want_early_inline_function_p (struct cgraph_edge *e)
|
|||
if (dump_file)
|
||||
fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
|
||||
"call is cold and code would grow by %i\n",
|
||||
cgraph_node_name (e->caller), e->caller->uid,
|
||||
cgraph_node_name (callee), callee->uid,
|
||||
xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
|
||||
xstrdup (cgraph_node_name (callee)), callee->uid,
|
||||
growth);
|
||||
want_inline = false;
|
||||
}
|
||||
|
@ -434,8 +434,8 @@ want_early_inline_function_p (struct cgraph_edge *e)
|
|||
if (dump_file)
|
||||
fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
|
||||
"callee is not leaf and code would grow by %i\n",
|
||||
cgraph_node_name (e->caller), e->caller->uid,
|
||||
cgraph_node_name (callee), callee->uid,
|
||||
xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
|
||||
xstrdup (cgraph_node_name (callee)), callee->uid,
|
||||
growth);
|
||||
want_inline = false;
|
||||
}
|
||||
|
@ -444,8 +444,8 @@ want_early_inline_function_p (struct cgraph_edge *e)
|
|||
if (dump_file)
|
||||
fprintf (dump_file, " will not early inline: %s/%i->%s/%i, "
|
||||
"growth %i exceeds --param early-inlining-insns\n",
|
||||
cgraph_node_name (e->caller), e->caller->uid,
|
||||
cgraph_node_name (callee), callee->uid,
|
||||
xstrdup (cgraph_node_name (e->caller)), e->caller->uid,
|
||||
xstrdup (cgraph_node_name (callee)), callee->uid,
|
||||
growth);
|
||||
want_inline = false;
|
||||
}
|
||||
|
@ -754,8 +754,8 @@ edge_badness (struct cgraph_edge *edge, bool dump)
|
|||
if (dump)
|
||||
{
|
||||
fprintf (dump_file, " Badness calculation for %s -> %s\n",
|
||||
cgraph_node_name (edge->caller),
|
||||
cgraph_node_name (callee));
|
||||
xstrdup (cgraph_node_name (edge->caller)),
|
||||
xstrdup (cgraph_node_name (callee)));
|
||||
fprintf (dump_file, " size growth %i, time growth %i\n",
|
||||
growth,
|
||||
time_growth);
|
||||
|
@ -910,8 +910,10 @@ update_edge_key (fibheap_t heap, struct cgraph_edge *edge)
|
|||
{
|
||||
fprintf (dump_file,
|
||||
" decreasing badness %s/%i -> %s/%i, %i to %i\n",
|
||||
cgraph_node_name (edge->caller), edge->caller->uid,
|
||||
cgraph_node_name (edge->callee), edge->callee->uid,
|
||||
xstrdup (cgraph_node_name (edge->caller)),
|
||||
edge->caller->uid,
|
||||
xstrdup (cgraph_node_name (edge->callee)),
|
||||
edge->callee->uid,
|
||||
(int)n->key,
|
||||
badness);
|
||||
}
|
||||
|
@ -925,8 +927,10 @@ update_edge_key (fibheap_t heap, struct cgraph_edge *edge)
|
|||
{
|
||||
fprintf (dump_file,
|
||||
" enqueuing call %s/%i -> %s/%i, badness %i\n",
|
||||
cgraph_node_name (edge->caller), edge->caller->uid,
|
||||
cgraph_node_name (edge->callee), edge->callee->uid,
|
||||
xstrdup (cgraph_node_name (edge->caller)),
|
||||
edge->caller->uid,
|
||||
xstrdup (cgraph_node_name (edge->callee)),
|
||||
edge->callee->uid,
|
||||
badness);
|
||||
}
|
||||
edge->aux = fibheap_insert (heap, badness, edge);
|
||||
|
@ -1608,8 +1612,8 @@ flatten_function (struct cgraph_node *node, bool early)
|
|||
if (dump_file)
|
||||
fprintf (dump_file,
|
||||
"Not inlining %s into %s to avoid cycle.\n",
|
||||
cgraph_node_name (callee),
|
||||
cgraph_node_name (e->caller));
|
||||
xstrdup (cgraph_node_name (callee)),
|
||||
xstrdup (cgraph_node_name (e->caller)));
|
||||
e->inline_failed = CIF_RECURSIVE_INLINING;
|
||||
continue;
|
||||
}
|
||||
|
@ -1649,8 +1653,8 @@ flatten_function (struct cgraph_node *node, bool early)
|
|||
recursing through the original node if the node was cloned. */
|
||||
if (dump_file)
|
||||
fprintf (dump_file, " Inlining %s into %s.\n",
|
||||
cgraph_node_name (callee),
|
||||
cgraph_node_name (e->caller));
|
||||
xstrdup (cgraph_node_name (callee)),
|
||||
xstrdup (cgraph_node_name (e->caller)));
|
||||
orig_callee = callee;
|
||||
inline_call (e, true, NULL, NULL);
|
||||
if (e->callee != orig_callee)
|
||||
|
@ -1752,7 +1756,8 @@ ipa_inline (void)
|
|||
{
|
||||
fprintf (dump_file,
|
||||
"\nInlining %s size %i.\n",
|
||||
cgraph_node_name (node), inline_summary (node)->size);
|
||||
cgraph_node_name (node),
|
||||
inline_summary (node)->size);
|
||||
fprintf (dump_file,
|
||||
" Called once from %s %i insns.\n",
|
||||
cgraph_node_name (node->callers->caller),
|
||||
|
@ -1815,8 +1820,8 @@ inline_always_inline_functions (struct cgraph_node *node)
|
|||
|
||||
if (dump_file)
|
||||
fprintf (dump_file, " Inlining %s into %s (always_inline).\n",
|
||||
cgraph_node_name (e->callee),
|
||||
cgraph_node_name (e->caller));
|
||||
xstrdup (cgraph_node_name (e->callee)),
|
||||
xstrdup (cgraph_node_name (e->caller)));
|
||||
inline_call (e, true, NULL, NULL);
|
||||
inlined = true;
|
||||
}
|
||||
|
@ -1865,8 +1870,8 @@ early_inline_small_functions (struct cgraph_node *node)
|
|||
|
||||
if (dump_file)
|
||||
fprintf (dump_file, " Inlining %s into %s.\n",
|
||||
cgraph_node_name (callee),
|
||||
cgraph_node_name (e->caller));
|
||||
xstrdup (cgraph_node_name (callee)),
|
||||
xstrdup (cgraph_node_name (e->caller)));
|
||||
inline_call (e, true, NULL, NULL);
|
||||
inlined = true;
|
||||
}
|
||||
|
|
|
@ -230,8 +230,8 @@ ipa_print_node_jump_functions (FILE *f, struct cgraph_node *node)
|
|||
continue;
|
||||
|
||||
fprintf (f, " callsite %s/%i -> %s/%i : \n",
|
||||
cgraph_node_name (node), node->uid,
|
||||
cgraph_node_name (cs->callee), cs->callee->uid);
|
||||
xstrdup (cgraph_node_name (node)), node->uid,
|
||||
xstrdup (cgraph_node_name (cs->callee)), cs->callee->uid);
|
||||
ipa_print_node_jump_functions_for_edge (f, cs);
|
||||
}
|
||||
|
||||
|
@ -1780,8 +1780,8 @@ ipa_make_edge_direct_to_target (struct cgraph_edge *ie, tree target)
|
|||
fprintf (dump_file, "ipa-prop: Discovered %s call to a known target "
|
||||
"(%s/%i -> %s/%i), for stmt ",
|
||||
ie->indirect_info->polymorphic ? "a virtual" : "an indirect",
|
||||
cgraph_node_name (ie->caller), ie->caller->uid,
|
||||
cgraph_node_name (ie->callee), ie->callee->uid);
|
||||
xstrdup (cgraph_node_name (ie->caller)), ie->caller->uid,
|
||||
xstrdup (cgraph_node_name (ie->callee)), ie->callee->uid);
|
||||
if (ie->call_stmt)
|
||||
print_gimple_stmt (dump_file, ie->call_stmt, 2, TDF_SLIM);
|
||||
else
|
||||
|
|
|
@ -215,8 +215,8 @@ lto_cgraph_replace_node (struct cgraph_node *node,
|
|||
{
|
||||
fprintf (cgraph_dump_file, "Replacing cgraph node %s/%i by %s/%i"
|
||||
" for symbol %s\n",
|
||||
cgraph_node_name (node), node->uid,
|
||||
cgraph_node_name (prevailing_node),
|
||||
xstrdup (cgraph_node_name (node)), node->uid,
|
||||
xstrdup (cgraph_node_name (prevailing_node)),
|
||||
prevailing_node->uid,
|
||||
IDENTIFIER_POINTER ((*targetm.asm_out.mangle_assembler_name)
|
||||
(IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (node->decl)))));
|
||||
|
|
|
@ -4699,8 +4699,8 @@ convert_callers_for_node (struct cgraph_node *node,
|
|||
if (dump_file)
|
||||
fprintf (dump_file, "Adjusting call (%i -> %i) %s -> %s\n",
|
||||
cs->caller->uid, cs->callee->uid,
|
||||
cgraph_node_name (cs->caller),
|
||||
cgraph_node_name (cs->callee));
|
||||
xstrdup (cgraph_node_name (cs->caller)),
|
||||
xstrdup (cgraph_node_name (cs->callee)));
|
||||
|
||||
ipa_modify_call_arguments (cs, cs->call_stmt, adjustments);
|
||||
|
||||
|
|
Loading…
Reference in New Issue