gcc/ChangeLog:
        * gimple-fold.c: Include "optinfo.h".
        (fold_gimple_assign): Port to optinfo.
        (gimple_fold_call): Likewise.
        * ipa-devirt.c: Include "optinfo.h".
        (ipa_devirt): Port to optinfo.
        * ipa.c: Include "optinfo.h".
        (walk_polymorphic_call_targets): Port to optinfo.
---
 gcc/gimple-fold.c | 29 ++++++++++++++---------------
 gcc/ipa-devirt.c  | 14 +++++++-------
 gcc/ipa.c         | 17 +++++++----------
 3 files changed, 28 insertions(+), 32 deletions(-)

diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c
index bd8c44a..d8a7a8b 100644
--- a/gcc/gimple-fold.c
+++ b/gcc/gimple-fold.c
@@ -66,6 +66,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "calls.h"
 #include "tree-vector-builder.h"
 #include "tree-ssa-strlen.h"
+#include "optinfo.h"
 
 /* Return true when DECL can be referenced from current unit.
    FROM_DECL (if non-null) specify constructor of variable DECL was taken from.
@@ -346,15 +347,14 @@ fold_gimple_assign (gimple_stmt_iterator *si)
                  = possible_polymorphic_call_targets (rhs, stmt, &final);
                if (final && targets.length () <= 1 && dbg_cnt (devirt))
                  {
-                   if (dump_enabled_p ())
+                   if (optinfo_enabled_p ())
                      {
-                       location_t loc = gimple_location_safe (stmt);
-                       dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
-                                        "resolving virtual function address "
-                                        "reference to function %s\n",
-                                        targets.length () == 1
-                                        ? targets[0]->name ()
-                                        : "NULL");
+                       OPTINFO_SUCCESS (stmt)
+                         << optinfo_printf ("resolving virtual function 
address "
+                                            "reference to function %s",
+                                            targets.length () == 1
+                                            ? targets[0]->name ()
+                                            : "NULL");
                      }
                    if (targets.length () == 1)
                      {
@@ -4064,14 +4064,13 @@ gimple_fold_call (gimple_stmt_iterator *gsi, bool 
inplace)
          if (final && targets.length () <= 1 && dbg_cnt (devirt))
            {
              tree lhs = gimple_call_lhs (stmt);
-             if (dump_enabled_p ())
+             if (optinfo_enabled_p ())
                {
-                 location_t loc = gimple_location_safe (stmt);
-                 dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, loc,
-                                  "folding virtual function call to %s\n",
-                                  targets.length () == 1
-                                  ? targets[0]->name ()
-                                  : "__builtin_unreachable");
+                 OPTINFO_SUCCESS (stmt)
+                   << optinfo_printf ("folding virtual function call to %s",
+                                      targets.length () == 1
+                                      ? targets[0]->name ()
+                                      : "__builtin_unreachable");
                }
              if (targets.length () == 1)
                {
diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c
index 308b6e6..f2a0785 100644
--- a/gcc/ipa-devirt.c
+++ b/gcc/ipa-devirt.c
@@ -131,6 +131,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "intl.h"
 #include "stringpool.h"
 #include "attribs.h"
+#include "optinfo.h"
 
 /* Hash based set of pairs of types.  */
 struct type_pair
@@ -3753,14 +3754,13 @@ ipa_devirt (void)
              }
            else if (dbg_cnt (devirt))
              {
-               if (dump_enabled_p ())
+               if (optinfo_enabled_p ())
                   {
-                    location_t locus = gimple_location_safe (e->call_stmt);
-                    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus,
-                                    "speculatively devirtualizing call "
-                                    "in %s to %s\n",
-                                    n->dump_name (),
-                                    likely_target->dump_name ());
+                   OPTINFO_SUCCESS (e->call_stmt)
+                     << "speculatively devirtualizing call in "
+                     << n
+                     << " to "
+                     << likely_target;
                   }
                if (!likely_target->can_be_discarded_p ())
                  {
diff --git a/gcc/ipa.c b/gcc/ipa.c
index 9330de5..8daa768 100644
--- a/gcc/ipa.c
+++ b/gcc/ipa.c
@@ -39,6 +39,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "debug.h"
 #include "stringpool.h"
 #include "attribs.h"
+#include "optinfo.h"
 
 /* Return true when NODE has ADDR reference.  */
 
@@ -222,17 +223,13 @@ walk_polymorphic_call_targets (hash_set<void *> 
*reachable_call_targets,
            target = cgraph_node::get_create
                       (builtin_decl_implicit (BUILT_IN_UNREACHABLE));
 
-         if (dump_enabled_p ())
+         if (optinfo_enabled_p ())
             {
-             location_t locus;
-             if (edge->call_stmt)
-               locus = gimple_location (edge->call_stmt);
-             else
-               locus = UNKNOWN_LOCATION;
-             dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, locus,
-                              "devirtualizing call in %s to %s\n",
-                              edge->caller->dump_name (),
-                              target->dump_name ());
+             OPTINFO_SUCCESS (edge->call_stmt)
+               << "devirtualizing call in "
+               << edge->caller
+               << " to "
+               << target;
            }
          edge = edge->make_direct (target);
          if (ipa_fn_summaries)
-- 
1.8.5.3

Reply via email to