From 09e37d7530d9532a831b14fa48ad9b0707a1749b Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Thu, 10 May 2018 15:06:56 -0400
Subject: [PATCH 32/33] FIXME: capture implementation location for some optinfo

---
 gcc/optimization-records.cc |  20 ++-
 gcc/optinfo.cc              |   5 +-
 gcc/optinfo.h               |  31 +++-
 gcc/tree-vect-data-refs.c   | 118 +++++++--------
 gcc/tree-vect-loop.c        | 351 ++++++++++++++++++++++----------------------
 gcc/tree-vectorizer.h       |   8 +-
 6 files changed, 291 insertions(+), 242 deletions(-)

diff --git a/gcc/optimization-records.cc b/gcc/optimization-records.cc
index 07bb114..dbcc203 100644
--- a/gcc/optimization-records.cc
+++ b/gcc/optimization-records.cc
@@ -53,6 +53,18 @@ along with GCC; see the file COPYING3.  If not see
 /* FIXME.  */
 
 static json::object *
+impl_location_to_json (location loc)
+{
+  json::object *obj = new json::object ();
+  obj->set ("file", new json::string (loc.m_file));
+  obj->set ("line", new json::number (loc.m_line));
+  obj->set ("function", new json::string (loc.m_function));
+  return obj;
+}
+
+/* FIXME.  */
+
+static json::object *
 location_to_json (location_t loc)
 {
   json::object *obj = new json::object ();
@@ -153,6 +165,9 @@ maybe_record_optimization (const optinfo *optinfo)
 
   json::object *obj = new json::object ();
 
+  obj->set ("impl_location",
+	    impl_location_to_json (optinfo->get_impl_location ()));
+
   const char *kind_str = opt_record_kind_to_string (optinfo->get_kind ());
   obj->set ("kind", new json::string (kind_str));
   json::array *message = new json::array ();
@@ -333,7 +348,10 @@ maybe_record_optimization_va (enum opt_record_kind kind,
 
   // FIXME: need to separate the pending from the info
   {
-    pending_optinfo optinfo (kind, optinfo_location (stmt));
+    // FIXME: use the actual implementation location
+    pending_optinfo optinfo (OPTINFO_IMPL_LOCATION,
+			     kind,
+			     optinfo_location (stmt));
     optinfo << msg;
   }
 
diff --git a/gcc/optinfo.cc b/gcc/optinfo.cc
index e866a82..535f682 100644
--- a/gcc/optinfo.cc
+++ b/gcc/optinfo.cc
@@ -132,10 +132,11 @@ optinfo::emit () const
 
 /* pending_optinfo's ctor.  */
 
-pending_optinfo::pending_optinfo (/*optinfo_emitter *emitter, */enum opt_record_kind kind,
+pending_optinfo::pending_optinfo (const location &impl_location,
+				  enum opt_record_kind kind,
 				  optinfo_location loc)
 {
-  m_optinfo = new optinfo (kind, loc);
+  m_optinfo = new optinfo (impl_location, kind, loc);
 }
 
 /* pending_optinfo's dtor.  Emit the pending information, and clean it up.  */
diff --git a/gcc/optinfo.h b/gcc/optinfo.h
index ae95c66..969022f 100644
--- a/gcc/optinfo.h
+++ b/gcc/optinfo.h
@@ -148,17 +148,39 @@ class optinfo_location
 
 class pending_optinfo;
 
+/* A way to identify where in the compiler source that optimization information
+   is being emitted from.  */
+/* FIXME: taken from selftest::location.  */
+
+struct location
+{
+  location (const char *file, int line, const char *function)
+    : m_file (file), m_line (line), m_function (function) {}
+
+  const char *m_file;
+  int m_line;
+  const char *m_function;
+};
+
+/* FIXME.  */
+
+#define OPTINFO_IMPL_LOCATION \
+  (location (__FILE__, __LINE__, __FUNCTION__))
+
 /* FIXME.  */
 
 class optinfo
 {
   friend class pending_optinfo;
  public:
-  optinfo (/*optinfo_emitter *emitter, */enum opt_record_kind kind,
+  optinfo (const location &impl_location,
+	   enum opt_record_kind kind,
 	   optinfo_location loc)
-    : /*m_emitter (emitter), */m_kind (kind), m_loc (loc), m_items () {}
+    : m_impl_location (impl_location), m_kind (kind), m_loc (loc), m_items ()
+  {}
   ~optinfo ();
 
+  location get_impl_location () const { return m_impl_location; }
   enum opt_record_kind get_kind () const { return m_kind; }
   optinfo_location get_location () const { return m_loc; }
   unsigned int num_items () const { return m_items.length (); }
@@ -167,7 +189,7 @@ class optinfo
   void emit () const;
 
  private:
-  /*optinfo_emitter *m_emitter;*/
+  location m_impl_location;
   enum opt_record_kind m_kind;
   optinfo_location m_loc;
   auto_vec <optinfo_item *> m_items;
@@ -190,7 +212,8 @@ class optinfo_printf
 class pending_optinfo
 {
  public:
-  pending_optinfo (/*optinfo_emitter *emitter, */enum opt_record_kind kind,
+  pending_optinfo (const location &impl_location,
+		   enum opt_record_kind kind,
 		   optinfo_location loc);
   ~pending_optinfo ();
 
diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index 760b76b..7500c64 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -340,7 +340,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 	{
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		<< ("versioning for alias not supported for: "
 		    "can't determine dependence between ")
 		<< slim (DR_REF (dra))
@@ -352,7 +352,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 
       if (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << ("versioning for alias required: "
 		"can't determine dependence between ")
 	    << slim (DR_REF (dra))
@@ -382,7 +382,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 	{
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		<< ("versioning for alias not supported for: "
 		    "bad dist vector for ")
 		<< slim (DR_REF (dra))
@@ -394,7 +394,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 
       if (optinfo_enabled_p ())
         {
-          emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+          EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << ("versioning for alias required: "
 		"bad dist vector for ")
 	    << slim (DR_REF (dra))
@@ -453,7 +453,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 	  if (!vect_preserves_scalar_order_p (DR_STMT (dra), DR_STMT (drb)))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << "READ_WRITE dependence in interleaving";
 	      return true;
 	    }
@@ -466,7 +466,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 	      else if (integer_zerop (indicator))
 		{
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		      << "access also has a zero step";
 		  return true;
 		}
@@ -480,7 +480,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 	     reversed (to make distance vector positive), and the actual
 	     distance is negative.  */
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "dependence distance negative";
 	  /* Record a negative dependence distance to later limit the
 	     amount of stmt copying / unrolling we can perform.
@@ -516,7 +516,7 @@ vect_analyze_data_ref_dependence (struct data_dependence_relation *ddr,
 
       if (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << ("not vectorized, possible dependence "
 		"between data-refs ")
 	    << slim (DR_REF (dra))
@@ -610,7 +610,7 @@ vect_slp_analyze_data_ref_dependence (struct data_dependence_relation *ddr)
     {
       if  (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << "can't determine dependence between "
 	    << slim (DR_REF (dra))
 	    << " and "
@@ -896,7 +896,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
 	    vect_location_writeln (OPT_RECORD_REMARK,
 			     "inner step divides the vector alignment.\n");
 	  else
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "inner step doesn't divide the vector"
 			     " alignment.\n");
 	}
@@ -913,7 +913,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
 	= multiple_p (DR_STEP_ALIGNMENT (dr) * vf, vector_alignment);
 
       if (!step_preserves_misalignment_p && optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			 "step doesn't divide the vector alignment.\n");
     }
 
@@ -937,7 +937,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
     {
       if (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                   "Unknown alignment for access: ");
 	  dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_SLIM, ref);
 	  dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
@@ -993,7 +993,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
 			   &const_misalignment))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "Non-constant misalignment for access: "
 	  << slim (ref);
       return true;
@@ -1002,7 +1002,7 @@ vect_compute_data_ref_alignment (struct data_reference *dr)
   SET_DR_MISALIGNMENT (dr, const_misalignment);
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
       << optinfo_printf ("misalign = %d bytes of ref ", DR_MISALIGNMENT (dr))
       << slim (ref);
 
@@ -1088,10 +1088,10 @@ verify_data_ref_alignment (data_reference_p dr)
       if (optinfo_enabled_p ())
 	{
 	  if (DR_IS_READ (dr))
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "not vectorized: unsupported unaligned load.");
 	  else
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "not vectorized: unsupported unaligned "
 			     "store.");
 
@@ -1208,7 +1208,7 @@ vector_alignment_reachable_p (struct data_reference *dr)
       if (DR_MISALIGNMENT (dr) % elmsize)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                     "data size does not divide the misalignment.\n");
 	  return false;
 	}
@@ -1219,7 +1219,7 @@ vector_alignment_reachable_p (struct data_reference *dr)
       tree type = TREE_TYPE (DR_REF (dr));
       bool is_packed = not_size_aligned (DR_REF (dr));
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << optinfo_printf ("Unknown misalignment, %snaturally aligned\n",
 			     is_packed ? "not " : "");
       return targetm.vectorize.vector_alignment_reachable (type, is_packed);
@@ -1811,7 +1811,7 @@ vect_enhance_data_refs_alignment (loop_vec_info loop_vinfo)
           if (!aligned_access_p (dr))
             {
               if (optinfo_enabled_p ())
-                emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+                EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                  "vector alignment may not be reachable\n");
               break;
             }
@@ -2332,7 +2332,7 @@ vect_analyze_data_refs_alignment (loop_vec_info vinfo)
 	    continue;
 
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "not vectorized: can't calculate alignment "
 			     "for data ref.\n");
 
@@ -2366,7 +2366,7 @@ vect_slp_analyze_and_verify_node_alignment (slp_tree node)
       || ! verify_data_ref_alignment (dr))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			 "not vectorized: bad data alignment in basic "
 			 "block.\n");
       return false;
@@ -2484,7 +2484,7 @@ vect_analyze_group_access_1 (struct data_reference *dr)
 
       if (optinfo_enabled_p ())
         {
- 	  vect_location_writeln (OPT_RECORD_FAILURE,
+ 	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                   "not consecutive access ");
 	  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
         }
@@ -2525,13 +2525,13 @@ vect_analyze_group_access_1 (struct data_reference *dr)
               if (DR_IS_WRITE (data_ref))
                 {
                   if (optinfo_enabled_p ())
-                    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+                    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                      "Two store stmts share the same dr.\n");
                   return false;
                 }
 
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				 "Two or more load stmts share the same dr.\n");
 
               /* For load use the same data-ref load.  */
@@ -2559,7 +2559,7 @@ vect_analyze_group_access_1 (struct data_reference *dr)
 	      if (DR_IS_WRITE (data_ref))
 		{
                   if (optinfo_enabled_p ())
-                    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+                    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                      "interleaved store with gaps\n");
 		  return false;
 		}
@@ -2587,7 +2587,7 @@ vect_analyze_group_access_1 (struct data_reference *dr)
       if (groupsize > 4096)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "group is too large\n");
 	  return false;
 	}
@@ -2598,7 +2598,7 @@ vect_analyze_group_access_1 (struct data_reference *dr)
 	  && !DR_IS_READ (dr))
         {
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "interleaved store with gaps\n");
 	  return false;
 	}
@@ -2690,7 +2690,7 @@ vect_analyze_data_ref_access (struct data_reference *dr)
   if (loop_vinfo && !step)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                 "bad data-ref access in loop\n");
       return false;
     }
@@ -3043,7 +3043,7 @@ vect_analyze_data_ref_accesses (vec_info *vinfo)
         && !vect_analyze_data_ref_access (dr))
       {
 	if (optinfo_enabled_p ())
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                   "not vectorized: complicated access pattern.\n");
 
         if (is_a <bb_vec_info> (vinfo))
@@ -3556,7 +3556,7 @@ vect_prune_runtime_alias_test_list (loop_vec_info loop_vinfo)
       if (optinfo_enabled_p ())
 	// FIXME: would be nice to have special highlighting for
 	// command-line options (e.g. params)
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << optinfo_printf ("number of versioning for alias "
 			     "run-time tests exceeds %d "
 			     "(--param vect-max-version-for-alias-checks)",
@@ -3959,7 +3959,7 @@ again:
       if (!dr || !DR_REF (dr))
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 	                     "not vectorized: unhandled data-ref\n");
           return false;
         }
@@ -4080,7 +4080,7 @@ again:
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                    "not vectorized: data ref analysis "
                                    "failed ");
 		  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -4096,7 +4096,7 @@ again:
       if (TREE_CODE (DR_BASE_ADDRESS (dr)) == INTEGER_CST)
         {
           if (optinfo_enabled_p ())
-            emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                              "not vectorized: base addr of dr is a "
                              "constant\n");
 
@@ -4112,7 +4112,7 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: volatile type ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
             }
@@ -4127,7 +4127,7 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: statement can throw an "
                                "exception ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -4146,7 +4146,7 @@ again:
 	{
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: statement is bitfield "
                                "access ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -4247,7 +4247,7 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: more than one data ref "
                                "in stmt: ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -4275,7 +4275,7 @@ again:
 	{
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: base object not addressable "
 			       "for stmt: ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -4298,7 +4298,7 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                "not vectorized: no vectype for stmt: ");
               dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
               dump_printf (MSG_MISSED_OPTIMIZATION, " scalar_type: ");
@@ -4327,7 +4327,7 @@ again:
 	{
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "got vectype for stmt: "
 		<< stmt
 		<< slim (STMT_VINFO_VECTYPE (stmt_info));
@@ -4350,7 +4350,7 @@ again:
 	      free_data_ref (dr);
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				   (gatherscatter == GATHER) ?
 				   "not vectorized: not suitable for gather "
 				   "load " :
@@ -4373,7 +4373,7 @@ again:
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
                                    "not vectorized: not suitable for strided "
                                    "load ");
 		  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
@@ -5061,7 +5061,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
   if (count != 3 && exact_log2 (count) == -1)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			 "the size of the group of accesses"
 			 " is not a power of 2 or not eqaul to 3\n");
       return false;
@@ -5080,7 +5080,7 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
 	  if (!GET_MODE_NUNITS (mode).is_constant (&nelt))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				 "cannot handle groups of 3 stores for"
 				 " variable-length vectors\n");
 	      return false;
@@ -5672,7 +5672,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
   if (single_element_p && maybe_gt (count, TYPE_VECTOR_SUBPARTS (vectype)))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			 "single-element interleaving not supported "
 			 "for not adjacent vector loads\n");
       return false;
@@ -5683,7 +5683,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
   if (count != 3 && exact_log2 (count) == -1)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			 "the size of the group of accesses"
 			 " is not a power of 2 or not equal to 3\n");
       return false;
@@ -5699,7 +5699,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
 	  if (!GET_MODE_NUNITS (mode).is_constant (&nelt))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				 "cannot handle groups of 3 loads for"
 				 " variable-length vectors\n");
 	      return false;
@@ -5720,7 +5720,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
 	      if (!can_vec_perm_const_p (mode, indices))
 		{
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				     "shuffle of 3 loads is not supported by"
 				     " target\n");
 		  return false;
@@ -5734,7 +5734,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
 	      if (!can_vec_perm_const_p (mode, indices))
 		{
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 				     "shuffle of 3 loads is not supported by"
 				     " target\n");
 		  return false;
@@ -5766,7 +5766,7 @@ vect_grouped_load_supported (tree vectype, bool single_element_p,
     }
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 		     "extract even/odd not supported by target\n");
   return false;
 }
@@ -6109,7 +6109,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shuffle of 2 fields structure is not \
 			      supported by target\n");
 	  return false;
@@ -6124,7 +6124,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shuffle of 2 fields structure is not \
 			      supported by target\n");
 	  return false;
@@ -6139,7 +6139,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shift permutation is not supported by target\n");
 	  return false;
 	}
@@ -6155,7 +6155,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "select is not supported by target\n");
 	  return false;
 	}
@@ -6219,7 +6219,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shuffle of 3 fields structure is not \
 			      supported by target\n");
 	  return false;
@@ -6234,7 +6234,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shift permutation is not supported by target\n");
 	  return false;
 	}
@@ -6248,7 +6248,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shift permutation is not supported by target\n");
 	  return false;
 	}
@@ -6262,7 +6262,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shift permutation is not supported by target\n");
 	  return false;
 	}
@@ -6276,7 +6276,7 @@ vect_shift_permute_load_chain (vec<tree> dr_chain,
       if (!can_vec_perm_const_p (TYPE_MODE (vectype), indices))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE) << (
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
 			     "shift permutation is not supported by target\n");
 	  return false;
 	}
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 6624c47..86bef1a 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -212,9 +212,10 @@ void vect_location_writeln (enum opt_record_kind kind,
 /* FIXME.  */
 
 pending_optinfo
-emit_optinfo_at_vect_location (enum opt_record_kind kind)
+emit_optinfo_at_vect_location (const location &impl_location,
+			       enum opt_record_kind kind)
 {
-  return pending_optinfo (/*emitter, */kind, vect_location_thing);
+  return pending_optinfo (impl_location, kind, vect_location_thing);
 }
 
 /* Function vect_determine_vectorization_factor
@@ -263,7 +264,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
   auto_vec<stmt_vec_info> mask_producers;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vect_determine_vectorization_factor ===";
 
   for (i = 0; i < nbbs; i++)
@@ -276,7 +277,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	  phi = si.phi ();
 	  stmt_info = vinfo_for_stmt (phi);
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "==> examining phi: "
 	      << phi;
 
@@ -290,7 +291,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "get vectype for scalar type:  "
 		    << slim (scalar_type);
 		}
@@ -300,7 +301,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		{
 		  if (optinfo_enabled_p ())
 		    {
-		      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 			<< "not vectorized: unsupported data-type "
 			<< slim (scalar_type);
 		    }
@@ -309,14 +310,14 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	      STMT_VINFO_VECTYPE (stmt_info) = vectype;
 
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "vectype: "
 		  << slim (vectype);
 
 	      if (optinfo_enabled_p ())
 		{
 #if 0
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "nunits = "
 		    << dump_dec (MSG_NOTE, TYPE_VECTOR_SUBPARTS (vectype));
 #endif
@@ -340,7 +341,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "==> examining statement: "
 		<< stmt;
 	    }
@@ -361,7 +362,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
                   stmt_info = vinfo_for_stmt (pattern_stmt);
                   if (optinfo_enabled_p ())
                     {
-                      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+                      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 			<< "==> examining pattern statement: "
 			<< stmt;
                     }
@@ -369,7 +370,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
               else
 	        {
 	          if (optinfo_enabled_p ())
-	            emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << "skip";
                   gsi_next (&si);
 	          continue;
@@ -411,7 +412,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		    {
 		      if (optinfo_enabled_p ())
 			{
-			  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+			  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 			    << "==> examining pattern def stmt: "
 			    << pattern_def_stmt;
 			}
@@ -450,7 +451,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		}
 	      if (optinfo_enabled_p ())
 		{
-	          emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	          EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		    << "not vectorized: irregular stmt: " << stmt;
 		}
 	      return false;
@@ -460,7 +461,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	    {
 	      if (optinfo_enabled_p ())
 	        {
-	          emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	          EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		    << "not vectorized: vector stmt in loop: " << stmt;
 	        }
 	      return false;
@@ -517,7 +518,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "get vectype for scalar type:  "
 		    << slim (scalar_type);
 		}
@@ -526,7 +527,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		{
 		  if (optinfo_enabled_p ())
 		    {
-		      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 			<< "not vectorized: unsupported data-type: "
 			<< slim (scalar_type);
 		    }
@@ -538,7 +539,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "vectype: "
 		    << slim (vectype);
 		}
@@ -558,7 +559,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 							     &dummy);
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "get vectype for scalar type:  "
 		    << slim (scalar_type);
 		}
@@ -568,7 +569,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		    << "not vectorized: unsupported data-type "
 		    << slim (scalar_type);
 		}
@@ -580,7 +581,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		    << ("not vectorized: different sized vector "
 			"types in statement, ")
 		    << slim (vectype)
@@ -592,14 +593,14 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "vectype: " << slim (vf_vectype);
 	    }
 
 	  if (optinfo_enabled_p ())
 	    {
 #if 0
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "nunits = "
 	      dump_dec (MSG_NOTE, TYPE_VECTOR_SUBPARTS (vf_vectype));
 	      dump_printf (MSG_NOTE, "\n");
@@ -620,7 +621,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
   if (optinfo_enabled_p ())
     {
 #if 0
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "vectorization factor = "
       dump_dec (MSG_NOTE, vectorization_factor);
 #endif
@@ -629,7 +630,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
   if (known_le (vectorization_factor, 1U))
     {
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: unsupported data-type";
       return false;
     }
@@ -652,7 +653,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	  if (!mask_type)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << "not vectorized: unsupported mask";
 	      return false;
 	    }
@@ -671,7 +672,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		{
 		  if (optinfo_enabled_p ())
 		    {
-		      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 			<< ("not vectorized: can't compute mask type "
 			    "for statement, ")
 			<< stmt;
@@ -692,7 +693,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		{
 		  if (optinfo_enabled_p ())
 		    {
-		      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 			<< ("not vectorized: different sized masks "
 			    "types in statement, ")
 			<< slim (mask_type)
@@ -706,7 +707,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 		{
 		  if (optinfo_enabled_p ())
 		    {
-		      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 			<< ("not vectorized: mixed mask and "
 			    "nonmask vector types in statement, ")
 			<< slim (mask_type)
@@ -733,7 +734,7 @@ vect_determine_vectorization_factor (loop_vec_info loop_vinfo)
 	{
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		<< ("not vectorized: can't compute mask type "
 		    "for statement, ")
 		<< stmt;
@@ -777,7 +778,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
 
   if (optinfo_enabled_p ())
     {
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "step: " << slim (step_expr)
 	<< ",  init: " << slim (init_expr);
     }
@@ -796,7 +797,7 @@ vect_is_simple_iv_evolution (unsigned loop_nb, tree access_fn, tree * init,
 	  || !flag_associative_math))
     {
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "step unknown";
       return false;
     }
@@ -821,7 +822,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
   bool double_reduc;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vect_analyze_scalar_cycles ===";
 
   /* First - identify all inductions.  Reduction detection assumes that all the
@@ -836,7 +837,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
 
       if (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	    << "Analyze phi: " << phi;
 	}
 
@@ -854,7 +855,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
 	  STRIP_NOPS (access_fn);
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "Access function of PHI: " << slim (access_fn);
 	    }
 	  STMT_VINFO_LOOP_PHI_EVOLUTION_BASE_UNCHANGED (stmt_vinfo)
@@ -877,7 +878,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
       gcc_assert (STMT_VINFO_LOOP_PHI_EVOLUTION_PART (stmt_vinfo) != NULL_TREE);
 
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "Detected induction";
       STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_induction_def;
     }
@@ -893,7 +894,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
 
       if (optinfo_enabled_p ())
         {
-          emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+          EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	    << "Analyze phi: " << phi;
         }
 
@@ -907,7 +908,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
           if (double_reduc)
             {
               if (optinfo_enabled_p ())
-                emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+                EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "Detected double reduction";
 
               STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_double_reduction_def;
@@ -919,7 +920,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
               if (loop != LOOP_VINFO_LOOP (loop_vinfo))
                 {
                   if (optinfo_enabled_p ())
-                    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+                    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << "Detected vectorizable nested cycle";
 
                   STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_nested_cycle;
@@ -929,7 +930,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
               else
                 {
                   if (optinfo_enabled_p ())
-                    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+                    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << "Detected reduction";
 
                   STMT_VINFO_DEF_TYPE (stmt_vinfo) = vect_reduction_def;
@@ -945,7 +946,7 @@ vect_analyze_scalar_cycles_1 (loop_vec_info loop_vinfo, struct loop *loop)
         }
       else
         if (optinfo_enabled_p ())
-          emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+          EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << "Unknown def-use cycle pattern";
     }
 }
@@ -1067,7 +1068,7 @@ vect_get_loop_niters (struct loop *loop, tree *assumptions,
   *number_of_iterationsm1 = chrec_dont_know;
   *number_of_iterations = chrec_dont_know;
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== get_loop_niters ===";
 
   if (!exit)
@@ -1508,7 +1509,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
 			  tree *number_of_iterations, gcond **inner_loop_cond)
 {
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vect_analyze_loop_form ===";
 
   /* Different restrictions apply when we are considering an inner-most loop,
@@ -1532,7 +1533,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if (loop->num_nodes != 2)
         {
           if (optinfo_enabled_p ())
-            emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: control flow in loop";
           return false;
         }
@@ -1540,7 +1541,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if (empty_block_p (loop->header))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: empty loop";
 	  return false;
 	}
@@ -1570,7 +1571,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if ((loop->inner)->inner || (loop->inner)->next)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: multiple nested loops";
 	  return false;
 	}
@@ -1578,7 +1579,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if (loop->num_nodes != 5)
         {
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: control flow in loop";
 	  return false;
         }
@@ -1589,7 +1590,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
 	  || single_exit (innerloop)->dest != EDGE_PRED (loop->latch, 0)->src)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: unsupported outerloop form";
 	  return false;
 	}
@@ -1604,7 +1605,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
 	  || !integer_onep (inner_assumptions))
 	{
 	  if (optinfo_enabled_p ())
-            emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: bad inner loop";
 	  return false;
 	}
@@ -1612,13 +1613,13 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if (!expr_invariant_in_loop_p (loop, inner_niter))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: inner-loop count not invariant";
 	  return false;
 	}
 
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "Considering outer-loop vectorization";
     }
 
@@ -1628,10 +1629,10 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       if (optinfo_enabled_p ())
         {
           if (!single_exit (loop))
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: multiple exits";
           else if (EDGE_COUNT (loop->header->preds) != 2)
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: too many incoming edges";
         }
       return false;
@@ -1645,7 +1646,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       || !gimple_seq_empty_p (phi_nodes (loop->latch)))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: latch block not empty";
       return false;
     }
@@ -1655,7 +1656,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
   if (e->flags & EDGE_ABNORMAL)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: abnormal loop exit edge";
       return false;
     }
@@ -1665,7 +1666,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
   if (!*loop_cond)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: complicated exit condition";
       return false;
     }
@@ -1675,7 +1676,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
       || chrec_contains_undetermined (*number_of_iterations))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: number of iterations cannot be computed";
       return false;
     }
@@ -1683,7 +1684,7 @@ vect_analyze_loop_form_1 (struct loop *loop, gcond **loop_cond,
   if (integer_zerop (*number_of_iterations))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: number of iterations = 0";
       return false;
     }
@@ -1724,7 +1725,7 @@ vect_analyze_loop_form (struct loop *loop)
 
   if (!LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
     if (optinfo_enabled_p ())
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "symbolic number of iterations is "
 	<< details (number_of_iterations);
 
@@ -1753,7 +1754,7 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo)
   int i;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vect_update_vf_for_slp ===";
 
   vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@@ -1789,13 +1790,13 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo)
 
   if (only_slp_in_loop)
     {
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "Loop contains only SLP stmts";
       vectorization_factor = LOOP_VINFO_SLP_UNROLLING_FACTOR (loop_vinfo);
     }
   else
     {
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "Loop contains SLP and non-SLP stmts";
       /* Both the vectorization factor and unroll factor have the form
 	 current_vector_size * X for some rational X, so they must have
@@ -1809,7 +1810,7 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo)
   if (optinfo_enabled_p ())
     {
 #if 0
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "Updating vectorization factor to ");
       dump_dec (MSG_NOTE, vectorization_factor);
 #endif
@@ -1860,7 +1861,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
   bool ok;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vect_analyze_loop_operations ===";
 
   for (i = 0; i < nbbs; i++)
@@ -1876,7 +1877,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
           stmt_info = vinfo_for_stmt (phi);
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "examining phi: ";
               dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
             }
@@ -1895,7 +1896,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
 		  && !vect_active_double_reduction_p (stmt_info))
                 {
                   if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		      << "Unsupported loop-closed phi in outer-loop";
                   return false;
                 }
@@ -1938,7 +1939,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
             {
               /* A scalar-dependence cycle that we don't support.  */
               if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << "not vectorized: scalar dependence cycle";
               return false;
             }
@@ -1965,7 +1966,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
             {
               if (optinfo_enabled_p ())
                 {
-		  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		    << "not vectorized: relevant phi not supported: "
 		    << phi;
                 }
@@ -1991,10 +1992,10 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo)
   if (!need_to_vectorize)
     {
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "All the computation can be taken out of the loop";
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: redundant loop. no profit to vectorize";
       return false;
     }
@@ -2027,7 +2028,7 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo)
 	  && (unsigned HOST_WIDE_INT) max_niter < assumed_vf)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << ("not vectorized: iteration count smaller than "
 		  "vectorization factor");
 	  return 0;
@@ -2041,10 +2042,10 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo)
   if (min_profitable_iters < 0)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: vectorization not profitable";
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: vector version will never be profitable";
       return -1;
     }
@@ -2063,10 +2064,10 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo)
       && LOOP_VINFO_INT_NITERS (loop_vinfo) < th)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: vectorization not profitable";
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << ("not vectorized: iteration count smaller than user "
 	      "specified loop bound parameter or minimum profitable "
 	      "iterations (whichever is more conservative)");
@@ -2081,10 +2082,10 @@ vect_analyze_loop_costing (loop_vec_info loop_vinfo)
 	  < MAX (th, (unsigned) min_profitable_estimate)))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "not vectorized: estimated iteration count too small";
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << ("not vectorized: estimated iteration count smaller "
 	      "than specified loop bound parameter or minimum "
 	      "profitable iterations (whichever is more "
@@ -2122,7 +2123,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
   if (!find_loop_nest (loop, &LOOP_VINFO_LOOP_NEST (loop_vinfo)))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("not vectorized: loop nest containing two "
 	      "or more consecutive inner loops cannot be "
 	      "vectorized");
@@ -2171,7 +2172,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
 		  }
 	      }
 	    if (optinfo_enabled_p ())
-	      emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		<< ("not vectorized: loop contains function "
 		    "calls or data references that cannot "
 		    "be analyzed");
@@ -2186,7 +2187,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "bad data references";
       return false;
     }
@@ -2206,7 +2207,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "bad data access";
       return false;
     }
@@ -2217,7 +2218,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "unexpected pattern";
       return false;
     }
@@ -2236,7 +2237,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
 	  && maybe_lt (max_vf, min_vf)))
     {
       if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "bad data dependence";
       return false;
     }
@@ -2246,7 +2247,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "can't determine vectorization factor";
       return false;
     }
@@ -2254,7 +2255,7 @@ vect_analyze_loop_2 (loop_vec_info loop_vinfo, bool &fatal)
       && maybe_lt (max_vf, LOOP_VINFO_VECT_FACTOR (loop_vinfo)))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "bad data dependence";
       return false;
     }
@@ -2297,7 +2298,7 @@ start_over:
   if (LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo) && optinfo_enabled_p ())
     {
 #if 0
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "vectorization_factor = "
       dump_dec (MSG_NOTE, vectorization_factor);
       dump_printf (MSG_NOTE, ", niters = " HOST_WIDE_INT_PRINT_DEC "\n",
@@ -2315,7 +2316,7 @@ start_over:
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "bad data alignment";
       return false;
     }
@@ -2337,7 +2338,7 @@ start_over:
     if (!ok)
       {
 	if (optinfo_enabled_p ())
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << "bad data alignment";
         return false;
       }
@@ -2360,7 +2361,7 @@ start_over:
   if (!ok)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "bad operation or unsupported loop bound";
       return false;
     }
@@ -2373,10 +2374,10 @@ start_over:
   if (optinfo_enabled_p ())
     {
       if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo))
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "using a fully-masked loop";
       else
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "not using a fully-masked loop";
     }
 
@@ -2393,7 +2394,7 @@ start_over:
       if (known_lt (wi::to_widest (scalar_niters), vf))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << ("loop has not enough iterations to support"
 		  " peeling for gaps");
 	  return false;
@@ -2407,7 +2408,7 @@ start_over:
   if (!res)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "Loop costings not worthwhile";
       return false;
     }
@@ -2445,7 +2446,7 @@ start_over:
       || LOOP_VINFO_PEELING_FOR_NITER (loop_vinfo))
     {
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "epilog loop required";
       if (!vect_can_advance_ivs_p (loop_vinfo)
 	  || !slpeel_can_duplicate_loop_p (LOOP_VINFO_LOOP (loop_vinfo),
@@ -2453,7 +2454,7 @@ start_over:
 							 (loop_vinfo))))
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not vectorized: can't create required epilog loop";
           goto again;
         }
@@ -2540,7 +2541,7 @@ again:
     }
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "re-trying with SLP disabled";
 
   /* Roll back state appropriately.  No SLP this time.  */
@@ -2618,7 +2619,7 @@ vect_analyze_loop (struct loop *loop, loop_vec_info orig_loop_vinfo)
   unsigned int next_size = 0;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "===== analyze_loop_nest =====";
 
   if (loop_outer (loop)
@@ -2626,7 +2627,7 @@ vect_analyze_loop (struct loop *loop, loop_vec_info orig_loop_vinfo)
       && LOOP_VINFO_VECTORIZABLE_P (loop_vec_info_for_loop (loop_outer (loop))))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "outer-loop already vectorized";
       return NULL;
     }
@@ -2639,7 +2640,7 @@ vect_analyze_loop (struct loop *loop, loop_vec_info orig_loop_vinfo)
       if (!loop_vinfo)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "bad loop form";
 	  return NULL;
 	}
@@ -2675,7 +2676,7 @@ vect_analyze_loop (struct loop *loop, loop_vec_info orig_loop_vinfo)
       if (optinfo_enabled_p ())
 	{
 #if 0
-	  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	    << "***** Re-trying analysis with vector size ";
 	  dump_dec (MSG_NOTE, current_vector_size);
 	  dump_printf (MSG_NOTE, "\n");
@@ -2978,7 +2979,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi,
   	    {
 	      if (optinfo_enabled_p ())
 		{
-		  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		    << "swapping oprnds: " << next_stmt;
 		}
 
@@ -3233,7 +3234,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
       if (!flow_bb_inside_loop_p (loop, gimple_bb (use_stmt)))
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "intermediate value used outside loop";
 
           return NULL;
@@ -3243,7 +3244,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
       if (nloop_uses > 1)
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "reduction value used in loop";
           return NULL;
         }
@@ -3256,7 +3257,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
   if (TREE_CODE (loop_arg) != SSA_NAME)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "reduction: not ssa_name: "
 	  << slim (loop_arg);
       return NULL;
@@ -3277,7 +3278,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
     {
       if (optinfo_enabled_p ())
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	    << "reduction: unhandled reduction operation: "
 	    << def_stmt;
 	}
@@ -3302,7 +3303,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
       if (nloop_uses > 1)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "reduction used in loop";
 	  return NULL;
 	}
@@ -3318,7 +3319,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
           || TREE_CODE (op1) != SSA_NAME)
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "unsupported phi node definition";
 
           return NULL;
@@ -3438,7 +3439,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, gimple *phi,
       if (optinfo_enabled_p ())
         {
 	  pending_optinfo info
-	    = emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    = EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	        << "reduction: multiple types: operation type: "
 		<< slim (type)
 		<< ", operands types: "
@@ -3653,7 +3654,7 @@ vect_get_known_peeling_cost (loop_vec_info loop_vinfo, int peel_iters_prologue,
     {
       *peel_iters_epilogue = assumed_vf / 2;
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << ("cost model: epilogue peel iters set to vf/2 "
 	      "because loop iterations are unknown");
 
@@ -3738,7 +3739,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
   /* Cost model disabled.  */
   if (unlimited_cost_model (LOOP_VINFO_LOOP (loop_vinfo)))
     {
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "cost model disabled";
       *ret_min_profitable_niters = 0;
       *ret_min_profitable_estimate = 0;
@@ -4003,7 +4004,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
     {
       /* FIXME: do we want to do something special for such a table of
 	 data?  */
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "Cost model analysis:\n"
 	<< optinfo_printf ("  Vector inside of loop cost: %d\n",
 			   vec_inside_cost)
@@ -4061,7 +4062,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
 		    "did not happen for a simd loop");
 
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << optinfo_printf ("cost model: the vector iteration cost = %d "
 			     "divided by the scalar iteration cost = %d "
 			     "is greater or equal to the vectorization factor = %d",
@@ -4081,7 +4082,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
     min_profitable_iters = assumed_vf + peel_iters_prologue;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << optinfo_printf ("  Runtime profitability threshold = %d",
 			 min_profitable_iters);
 
@@ -4107,7 +4108,7 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
     }
   min_profitable_estimate = MAX (min_profitable_estimate, min_profitable_iters);
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << optinfo_printf ("  Static estimate profitability threshold = %d",
 			 min_profitable_estimate);
 
@@ -4359,7 +4360,7 @@ vect_model_induction_cost (stmt_vec_info stmt_info, int ncopies)
 				 stmt_info, 0, vect_prologue);
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << optinfo_printf ("vect_model_induction_cost: inside_cost = %d, "
 			 "prologue_cost = %d",
 			 inside_cost, prologue_cost);
@@ -4954,7 +4955,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
 
           if (optinfo_enabled_p ())
             {
-              emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "transform reduction: created def-use cycle: "
 		<< phi << SSA_NAME_DEF_STMT (def);
             }
@@ -5441,7 +5442,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
          v_out2 = reduc_expr <v_out1>  */
 
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "Reduce using direct vector reduction";
 
       vec_elem_type = TREE_TYPE (TREE_TYPE (new_phi_result));
@@ -5712,7 +5713,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
           tree rhs;
 
           if (optinfo_enabled_p ())
-            emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "Reduce using vector shifts";
 
 	  mode1 = TYPE_MODE (vectype1);
@@ -5741,7 +5742,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
 	     s_out3 = extract_field <v_out2, bitpos>  */
 
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "extract scalar result";
 
 	  rhs = build3 (BIT_FIELD_REF, scalar_type, new_temp,
@@ -5765,7 +5766,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt,
                }  */
 
           if (optinfo_enabled_p ())
-            emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+            EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "Reduce using scalar code";
 
 	  int vec_size_in_bits = tree_to_uhwi (TYPE_SIZE (vectype1));
@@ -6089,7 +6090,7 @@ vect_finalize_reduction:
                                loop_latch_edge (outer_loop), UNKNOWN_LOCATION);
                   if (optinfo_enabled_p ())
                     {
-                      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+                      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 			<< "created double reduction phi node: "
 			<< vect_phi;
                     }
@@ -6771,7 +6772,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (STMT_VINFO_REDUC_TYPE (stmt_info) == FOLD_LEFT_REDUCTION)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "in-order reduction chain without SLP";
 	  return false;
 	}
@@ -6825,7 +6826,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (reduc_index == -1)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "conditional reduction chains not supported";
 	  return false;
 	}
@@ -6850,7 +6851,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 					       vectype_in, OPTIMIZE_FOR_SPEED))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "optimizing condition reduction with FOLD_EXTRACT_LAST";
 	  STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info) = EXTRACT_LAST_REDUCTION;
 	}
@@ -6890,7 +6891,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  if (cond_reduc_val)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "condition expression based on integer induction";
 	      STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
 		= INTEGER_INDUC_COND_REDUCTION;
@@ -6915,7 +6916,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	      if (e && (integer_onep (e) || integer_zerop (e)))
 		{
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << ("condition expression based on "
 			  "compile time constant");
 		  /* Record reduction code at analysis stage.  */
@@ -6958,7 +6959,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 						ops[reduc_index], 0, NULL))
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "unsupported condition in reduction";
 	  return false;
         }
@@ -6973,7 +6974,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  /* Shifts and rotates are only supported by vectorizable_shifts,
 	     not vectorizable_reduction.  */
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "unsupported shift or rotation";
 	  return false;
 	}
@@ -6983,7 +6984,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (!optab)
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "no optab";
 
           return false;
@@ -7007,7 +7008,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  && !vect_worthwhile_without_simd_p (loop_vinfo, code))
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "not worthwhile without SIMD support";
 
           return false;
@@ -7113,7 +7114,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 						  OPTIMIZE_FOR_SPEED))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << "reduc op not supported by target";
 
 	      reduc_fn = IFN_LAST;
@@ -7124,7 +7125,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  if (!nested_cycle || double_reduc)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << "no reduc code for scalar code";
 
 	      return false;
@@ -7149,7 +7150,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       && !nunits_out.is_constant ())
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("missing target support for reduction on"
 	      " variable-length vectors");
       return false;
@@ -7159,7 +7160,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       && ncopies > 1)
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("multiple types in double reduction or condition "
 	      "reduction");
       return false;
@@ -7189,7 +7190,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 
 	 which is a reassociation of the original operation.  */
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "in-order double reduction not supported";
 
       return false;
@@ -7202,7 +7203,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       /* We cannot use in-order reductions in this case because there is
 	 an implicit reassociation of the operations involved.  */
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << "in-order unchained SLP reductions not supported";
       return false;
     }
@@ -7217,7 +7218,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 					  vectype_out, OPTIMIZE_FOR_SPEED))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("reduction on variable-length vectors requires"
 	      " target support for a vector-shift-and-insert"
 	      " operation");
@@ -7240,7 +7241,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  && !can_duplicate_and_interleave_p (group_size, elt_mode))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << ("unsupported form of SLP reduction for"
 		  " variable-length vectors: cannot build"
 		  " initial vector");
@@ -7252,7 +7253,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (!multiple_p (nunits_out, group_size))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << ("unsupported form of SLP reduction for"
 		  " variable-length vectors: the vector size"
 		  " is not a multiple of the number of results");
@@ -7273,7 +7274,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       else
         {
           if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "invalid types in dot-prod";
 
           return false;
@@ -7287,7 +7288,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (! max_loop_iterations (loop, &ni))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "loop count not known, cannot create cond reduction";
 	  return false;
 	}
@@ -7301,7 +7302,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
       if (wi::geu_p (ni, wi::to_widest (max_index)))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "loop size is greater than data size";
 	  return false;
 	}
@@ -7359,7 +7360,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  || code == SAD_EXPR))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("multi def-use cycle not possible for lane-reducing "
 	      "reduction operation");
       return false;
@@ -7385,7 +7386,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 						      OPTIMIZE_FOR_SPEED)))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("can't use a fully-masked loop because no"
 		      " conditional operation is available");
 	      LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo) = false;
@@ -7393,7 +7394,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	  else if (reduc_index == -1)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("can't use a fully-masked loop for chained"
 		      " reductions");
 	      LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo) = false;
@@ -7404,7 +7405,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
 	}
       if (optinfo_enabled_p ()
 	  && reduction_type == FOLD_LEFT_REDUCTION)
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "using an in-order (fold-left) reduction";
       STMT_VINFO_TYPE (stmt_info) = reduc_vec_info_type;
       return true;
@@ -7413,7 +7414,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi,
   /* Transform.  */
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "transform reduction";
 
   /* FORNOW: Multiple types are not supported for condition.  */
@@ -7709,7 +7710,7 @@ vectorizable_induction (gimple *phi,
       if (ncopies > 1)
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << "multiple types in nested loop";
 	  return false;
 	}
@@ -7740,7 +7741,7 @@ vectorizable_induction (gimple *phi,
 		&& !STMT_VINFO_LIVE_P (exit_phi_vinfo)))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("inner-loop induction only used outside "
 		      "of the outer vectorized loop");
 	      return false;
@@ -7758,7 +7759,7 @@ vectorizable_induction (gimple *phi,
     {
       /* The current SLP code creates the initial value element-by-element.  */
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	  << ("SLP induction not supported for variable-length"
 	      " vectors.\n");
       return false;
@@ -7768,7 +7769,7 @@ vectorizable_induction (gimple *phi,
     {
       STMT_VINFO_TYPE (stmt_info) = induc_vec_info_type;
       if (optinfo_enabled_p ())
-        emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+        EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "=== vectorizable_induction ===";
       vect_model_induction_cost (stmt_info, ncopies);
       return true;
@@ -7782,7 +7783,7 @@ vectorizable_induction (gimple *phi,
      [X, X + S, X + 2*S, X + 3*S].  */
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "transform induction phi";
 
   latch_e = loop_latch_edge (iv_loop);
@@ -8176,7 +8177,7 @@ vectorizable_induction (gimple *phi,
 	  STMT_VINFO_VEC_STMT (stmt_vinfo) = new_stmt;
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "vector of inductions after inner-loop:" << new_stmt;
 	    }
 	}
@@ -8185,7 +8186,7 @@ vectorizable_induction (gimple *phi,
 
   if (optinfo_enabled_p ())
     {
-      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	<< "transform induction: created def-use cycle: "
 	<< induction_phi << SSA_NAME_DEF_STMT (vec_def);
     }
@@ -8233,7 +8234,7 @@ vectorizable_live_operation (gimple *stmt,
     {
       gcc_assert (is_simple_and_all_uses_invariant (stmt, loop_vinfo));
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << "statement is simple and uses invariant.  Leaving in place";
       return true;
     }
@@ -8260,7 +8261,7 @@ vectorizable_live_operation (gimple *stmt,
       if (!can_div_trunc_p (pos, nunits, &vec_entry, &vec_index))
 	{
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 	      << ("Cannot determine which vector holds the"
 		  " final result");
 	  return false;
@@ -8276,7 +8277,7 @@ vectorizable_live_operation (gimple *stmt,
 					       OPTIMIZE_FOR_SPEED))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("can't use a fully-masked loop because "
 		      "the target doesn't support extract last "
 		      "reduction");
@@ -8285,7 +8286,7 @@ vectorizable_live_operation (gimple *stmt,
 	  else if (slp_node)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("can't use a fully-masked loop because an "
 		      "SLP statement is live after the loop");
 	      LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo) = false;
@@ -8293,7 +8294,7 @@ vectorizable_live_operation (gimple *stmt,
 	  else if (ncopies > 1)
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_FAILURE)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
 		  << ("can't use a fully-masked loop because"
 		      " ncopies is greater than 1.\n");
 	      LOOP_VINFO_CAN_FULLY_MASK_P (loop_vinfo) = false;
@@ -8441,7 +8442,7 @@ vect_loop_kill_debug_uses (struct loop *loop, gimple *stmt)
 	      if (gimple_debug_bind_p (ustmt))
 		{
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << "killing debug use";
 
 		  gimple_debug_bind_reset_value (ustmt);
@@ -8642,7 +8643,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
   unsigned int th;
 
   if (optinfo_enabled_p ())
-    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
       << "=== vec_transform_loop ===";
 
   /* Use the more conservative vectorization threshold.  If the number
@@ -8655,7 +8656,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
       && !LOOP_VINFO_NITERS_KNOWN_P (loop_vinfo))
     {
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << optinfo_printf ("Profitability threshold is %d loop iterations",
 			     th);
       check_profitability = true;
@@ -8758,7 +8759,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 	  gphi *phi = si.phi ();
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "------>vectorizing phi: " << phi;
 	    }
 	  stmt_info = vinfo_for_stmt (phi);
@@ -8776,7 +8777,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 	      && (maybe_ne
 		  (TYPE_VECTOR_SUBPARTS (STMT_VINFO_VECTYPE (stmt_info)), vf))
 	      && optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "multiple-types";
 
 	  if ((STMT_VINFO_DEF_TYPE (stmt_info) == vect_induction_def
@@ -8785,7 +8786,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 	      && ! PURE_SLP_STMT (stmt_info))
 	    {
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "transform phi";
 	      vect_transform_stmt (phi, NULL, NULL, NULL, NULL);
 	    }
@@ -8814,7 +8815,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "------>vectorizing statement: " << stmt;
 	    }
 
@@ -8885,7 +8886,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 		    {
 		      if (optinfo_enabled_p ())
 			{
-			  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+			  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 			    << "==> vectorizing pattern def stmt: "
 			    << pattern_def_stmt;
 			}
@@ -8912,7 +8913,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 		  && optinfo_enabled_p ())
 		  /* For SLP VF is set according to unrolling factor, and not
 		     to vector size, hence for SLP this print is not valid.  */
-		emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "multiple-types";
 	    }
 
@@ -8925,7 +8926,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 		  slp_scheduled = true;
 
 		  if (optinfo_enabled_p ())
-		    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		      << "=== scheduling SLP instances ===";
 
 		  vect_schedule_slp (loop_vinfo);
@@ -8945,7 +8946,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
 
 	  /* -------- vectorize statement ------------ */
 	  if (optinfo_enabled_p ())
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "transform statement";
 
 	  grouped_store = false;
@@ -9061,17 +9062,17 @@ vect_transform_loop (loop_vec_info loop_vinfo)
     {
       if (!LOOP_VINFO_EPILOGUE_P (loop_vinfo))
 	{
-	  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	    << "LOOP VECTORIZED";
 	  if (loop->inner)
-	    emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	      << "OUTER LOOP VECTORIZED";
 	  dump_printf (MSG_NOTE, "\n");
 	}
       else
 	{
 #if 0
-	  emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	    << "LOOP EPILOGUE VECTORIZED (VS="
 	  dump_dec (MSG_NOTE, current_vector_size);
 	    << ")";
@@ -9232,7 +9233,7 @@ optimize_mask_stores (struct loop *loop)
       if (dom_info_available_p (CDI_DOMINATORS))
 	set_immediate_dominator (CDI_DOMINATORS, store_bb, bb);
       if (optinfo_enabled_p ())
-	emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 	  << optinfo_printf ("Create new block %d to sink mask stores.",
 			     store_bb->index);
       /* Create vector comparison with boolean result.  */
@@ -9272,7 +9273,7 @@ optimize_mask_stores (struct loop *loop)
 	  gsi_to = gsi_start_bb (store_bb);
 	  if (optinfo_enabled_p ())
 	    {
-	      emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		<< "Move stmt to created bb " << last;
 	    }
 	  /* Move all stored value producers if possible.  */
@@ -9338,7 +9339,7 @@ optimize_mask_stores (struct loop *loop)
 
 	      /* Can move STMT1 to STORE_BB.  */
 	      if (optinfo_enabled_p ())
-		emit_optinfo_at_vect_location (OPT_RECORD_REMARK)
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
 		  << "move stmt to created bb"
 		  << stmt1;
 	      gsi_move_before (&gsi_from, &gsi_to);
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 1a08b5e..c19fc4a 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1393,7 +1393,13 @@ extern void vect_location_writeln (enum opt_record_kind kind,
 				   const char *fmt, ...)
   ATTRIBUTE_PRINTF_2;
 
-extern pending_optinfo emit_optinfo_at_vect_location (enum opt_record_kind);
+extern pending_optinfo
+emit_optinfo_at_vect_location (const location &impl_location,
+			       enum opt_record_kind kind);
+
+#define EMIT_OPTINFO_AT_VECT_LOCATION(KIND) \
+  (emit_optinfo_at_vect_location (OPTINFO_IMPL_LOCATION, (KIND)))
+
 
 /*-----------------------------------------------------------------*/
 /* Function prototypes.                                            */
-- 
1.8.5.3

