gcc/ChangeLog:
        * ipa-inline.c: Include "optinfo.h".
        (report_inline_failed_reason): Use OPTINFO_FAILURE.
        (flatten_function): Use OPTINFO_SUCCESS.
        (early_inline_small_functions): Likewise.
        * tree-inline.c: Include "optinfo.h".
        (expand_call_inline): Use OPTINFO_SUCCESS.
---
 gcc/ipa-inline.c  | 25 +++++++++++++++++++++++++
 gcc/tree-inline.c | 10 ++++++++++
 2 files changed, 35 insertions(+)

diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c
index b7f213f..3fd064a 100644
--- a/gcc/ipa-inline.c
+++ b/gcc/ipa-inline.c
@@ -120,6 +120,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "attribs.h"
 #include "asan.h"
+#include "optinfo.h"
 
 typedef fibonacci_heap <sreal, cgraph_edge> edge_heap_t;
 typedef fibonacci_node <sreal, cgraph_edge> edge_heap_node_t;
@@ -250,6 +251,18 @@ report_inline_failed_reason (struct cgraph_edge *e)
          (dump_file, 2, opts_for_fn (e->caller->decl),
           opts_for_fn (e->callee->ultimate_alias_target ()->decl));
     }
+  /* FIXME: partial re-implementation in terms of optinfo.  */
+  if (optinfo_enabled_p ())
+    {
+      OPTINFO_FAILURE (e->call_stmt)
+       << "not inlinable: "
+       << e->caller
+       << " -> "
+       << e->callee
+       << ": "
+       << cgraph_inline_failed_string (e->inline_failed);
+      // FIXME: etc; see the option mismatch code above
+    }
 }
 
  /* Decide whether sanitizer-related attributes allow inlining. */
@@ -2167,6 +2180,12 @@ flatten_function (struct cgraph_node *node, bool early)
        fprintf (dump_file, " Inlining %s into %s.\n",
                 xstrdup_for_dump (callee->name ()),
                 xstrdup_for_dump (e->caller->name ()));
+      if (optinfo_enabled_p ())
+       OPTINFO_SUCCESS (e->call_stmt)
+         << "inlining "
+         << callee
+         << " into "
+         << e->caller;
       orig_callee = callee;
       inline_call (e, true, NULL, NULL, false);
       if (e->callee != orig_callee)
@@ -2677,6 +2696,12 @@ early_inline_small_functions (struct cgraph_node *node)
        fprintf (dump_file, " Inlining %s into %s.\n",
                 xstrdup_for_dump (callee->name ()),
                 xstrdup_for_dump (e->caller->name ()));
+      if (optinfo_enabled_p ())
+       OPTINFO_SUCCESS (e->call_stmt)
+         << "inlining "
+         << callee
+         << " into "
+         << e->caller;
       inline_call (e, true, NULL, NULL, false);
       inlined = true;
     }
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c
index 5a0a252..5d3598e 100644
--- a/gcc/tree-inline.c
+++ b/gcc/tree-inline.c
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "attribs.h"
 #include "sreal.h"
+#include "optinfo.h"
 
 /* I'm not real happy about this, but we need to handle gimple and
    non-gimple trees.  */
@@ -4719,6 +4720,15 @@ expand_call_inline (basic_block bb, gimple *stmt, 
copy_body_data *id)
       id->src_node->dump (dump_file);
       id->dst_node->dump (dump_file);
     }
+  /* FIXME.  */
+  if (optinfo_enabled_p ())
+    OPTINFO_SUCCESS(call_stmt)
+      << "Inlining "
+      << id->src_node
+      << " to "
+      << id->dst_node
+      << optinfo_printf (" with frequency %4.2f",
+                        cg_edge->sreal_frequency ().to_double ());
 
   /* This is it.  Duplicate the callee body.  Assume callee is
      pre-gimplified.  Note that we must not alter the caller
-- 
1.8.5.3

Reply via email to