aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-inline.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2018-11-08 15:38:30 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2018-11-08 15:38:30 +0000
commit4174a33ac66f45536e3d7bd46167d7f678310931 (patch)
tree5235bd90981bc2004687d8de9394f82565c2c784 /gcc/tree-inline.c
parent204839e7c41678c3f93975fe4356492040fcf411 (diff)
downloadgcc-4174a33ac66f45536e3d7bd46167d7f678310931.zip
gcc-4174a33ac66f45536e3d7bd46167d7f678310931.tar.gz
gcc-4174a33ac66f45536e3d7bd46167d7f678310931.tar.bz2
ipa-inline.c/tree-inline.c: port from fprintf to dump API (PR ipa/86395)
This patch ports various fprintf calls in the inlining code to using the dump API, using the %C format code for printing cgraph_node *. I focussed on the dump messages that seemed most significant to end-users; I didn't port all of the calls. Doing so makes this information appear in -fopt-info and in optimization records, rather than just in the dump_file. It also changes the affected dumpfile-dumps from being unconditional (assuming the dump_file is enabled) to being guarded by the MSG_* status. Hence various tests with dg-final scan-*-dump directives need to gain "-all" or "-optimized" suffixes to -fdump-ipa-inline. The use of %C throughout also slightly changes the dump format for several messages, e.g. changing: Inlining void inline_me(char*) into int main(int, char**). to: ../../src/gcc/testsuite/g++.dg/tree-ssa/inline-1.C:13:8: optimized: Inlining void inline_me(char*)/0 into int main(int, char**)/2. amongst other things adding "/order" suffixes to the cgraph node names. gcc/ChangeLog: PR ipa/86395 * doc/invoke.texi (-fdump-ipa-): Document the "-optimized", "-missed", "-note", and "-all" sub-options. * ipa-inline.c (caller_growth_limits): Port from fprintf to dump API. (can_early_inline_edge_p): Likewise. (want_early_inline_function_p): Likewise. (want_inline_self_recursive_call_p): Likewise. (recursive_inlining): Likewise. (inline_small_functions): Likewise. (flatten_function): Likewise. (ipa_inline): Likewise. (inline_always_inline_functions): Likewise. (early_inline_small_functions): Likewise. (early_inliner): Likewise. * tree-inline.c (expand_call_inline): Likewise. gcc/testsuite/ChangeLog: PR ipa/86395 * g++.dg/ipa/devirt-12.C: Add "-all" suffix to "-fdump-ipa-inline". * g++.dg/ipa/imm-devirt-1.C: Add "-optimized" suffix to "-fdump-tree-einline". * g++.dg/tree-prof/inline_mismatch_args.C: Add "-all" suffix to "-fdump-tree-einline". * g++.dg/tree-ssa/inline-1.C: Add "-optimized" suffix to "-fdump-tree-einline". * g++.dg/tree-ssa/inline-2.C: Likewise. * g++.dg/tree-ssa/inline-3.C: Likewise. * g++.dg/tree-ssa/inline-4.C: New test, based on inline-1.C, but using "-fopt-info-inline". * gcc.dg/ipa/fopt-info-inline-1.c: New test. * gcc.dg/ipa/inline-4.c: Add "-all" suffix to "-fdump-ipa-inline". Add "-fopt-info-inline" and dg-optimized directive. * gcc.dg/ipa/inline-7.c: Add "-optimized" suffix to "-fdump-tree-einline". Add "-fopt-info-inline" and dg-optimized directive. Update scan-tree-dump-times to reflect /order suffixes. * gcc.dg/ipa/inlinehint-4.c: Update scan-tree-dump-times to reflect /order suffixes. * gcc.dg/plugin/dump-1.c: Add "-loop" to "-fopt-info-note" to avoid getting extra messages from inliner. * gcc.dg/plugin/dump-2.c: Likewise. * gcc.dg/pr26570.c: Add dg-prune-output to ignore new "function body not available" missed optimization messages. * gcc.dg/pr71969-2.c: Update scan-tree-dump-times to reflect /order suffixes. * gcc.dg/pr71969-3.c: Likewise. * gcc.dg/tree-ssa/inline-11.c: Add "-all" suffix to "-fdump-tree-einline". * gcc.dg/tree-ssa/inline-3.c: Add "-optimized" suffix to "-fdump-tree-einline". Update scan-tree-dump-times to reflect /order suffixes. * gcc.dg/tree-ssa/inline-4.c: Add "-optimized" suffix to "-fdump-tree-einline". Add "-fopt-info-inline" and dg-optimized directive. * gcc.dg/tree-ssa/inline-8.c: Add "-optimized" suffix to "-fdump-tree-einline". * gfortran.dg/pr79966.f90: Update scan-ipa-dump to reflect /order suffixes. From-SVN: r265920
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r--gcc/tree-inline.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 297fcd7..5ce319a 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -4673,14 +4673,20 @@ expand_call_inline (basic_block bb, gimple *stmt, copy_body_data *id)
/* Add local vars in this inlined callee to caller. */
add_local_variables (id->src_cfun, cfun, id);
- if (dump_file && (dump_flags & TDF_DETAILS))
+ if (dump_enabled_p ())
{
- fprintf (dump_file, "Inlining %s to %s with frequency %4.2f\n",
- id->src_node->dump_name (),
- id->dst_node->dump_name (),
- cg_edge->sreal_frequency ().to_double ());
- id->src_node->dump (dump_file);
- id->dst_node->dump (dump_file);
+ char buf[128];
+ snprintf (buf, sizeof(buf), "%4.2f",
+ cg_edge->sreal_frequency ().to_double ());
+ dump_printf_loc (MSG_NOTE | MSG_PRIORITY_INTERNALS,
+ call_stmt,
+ "Inlining %C to %C with frequency %s\n",
+ id->src_node, id->dst_node, buf);
+ if (dump_file && (dump_flags & TDF_DETAILS))
+ {
+ id->src_node->dump (dump_file);
+ id->dst_node->dump (dump_file);
+ }
}
/* This is it. Duplicate the callee body. Assume callee is