From d015875a4a03304aebb637da9800a23ade86dbae Mon Sep 17 00:00:00 2001
From: David Malcolm <dmalcolm@redhat.com>
Date: Mon, 14 May 2018 16:41:13 -0400
Subject: [PATCH 41/83] FIXME: various vect cleanups

---
 gcc/tree-vect-data-refs.c | 112 ++++++++++++++++++++++------------------------
 1 file changed, 54 insertions(+), 58 deletions(-)

diff --git a/gcc/tree-vect-data-refs.c b/gcc/tree-vect-data-refs.c
index d0138f9..d5a3c5a 100644
--- a/gcc/tree-vect-data-refs.c
+++ b/gcc/tree-vect-data-refs.c
@@ -4077,10 +4077,10 @@ again:
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-                                   "not vectorized: data ref analysis "
-                                   "failed ");
-		  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		    << ("not vectorized: data ref analysis "
+			"failed ")
+		    << stmt;
 		}
 
 	      if (is_a <bb_vec_info> (vinfo))
@@ -4109,9 +4109,9 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-                               "not vectorized: volatile type ");
-              dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		<< "not vectorized: volatile type "
+		<< stmt;
             }
 
           if (is_a <bb_vec_info> (vinfo))
@@ -4124,10 +4124,9 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              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);
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		<< "not vectorized: statement can throw an exception "
+		<< stmt;
             }
 
           if (is_a <bb_vec_info> (vinfo))
@@ -4143,10 +4142,10 @@ again:
 	{
           if (optinfo_enabled_p ())
             {
-              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-                               "not vectorized: statement is bitfield "
-                               "access ");
-              dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		<< ("not vectorized: statement is bitfield "
+		    "access ")
+		<< stmt;
             }
 
           if (is_a <bb_vec_info> (vinfo))
@@ -4168,9 +4167,9 @@ again:
 	{
 	  if (optinfo_enabled_p ())
 	    {
-	      dump_printf_loc (MSG_MISSED_OPTIMIZATION,  vect_location,
-	                       "not vectorized: dr in a call ");
-	      dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		<< "not vectorized: dr in a call "
+		<< stmt;
 	    }
 
 	  if (is_a <bb_vec_info> (vinfo))
@@ -4202,10 +4201,9 @@ again:
 
 	  if (optinfo_enabled_p ())
 	    {
-	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK) << optinfo_printf (
-                               "analyze in outer loop: ");
-	      dump_generic_expr (MSG_NOTE, TDF_SLIM, init_ref);
-	      dump_printf (MSG_NOTE, "\n");
+	      EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_REMARK)
+		<< "analyze in outer loop: "
+		<< slim (init_ref);
 	    }
 
 	  if (!dr_analyze_innermost (&STMT_VINFO_DR_WRT_VEC_LOOP (stmt_info),
@@ -4244,9 +4242,9 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-                               "not vectorized: more than one data ref "
-                               "in stmt: ");
+              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);
             }
 
@@ -4272,9 +4270,9 @@ again:
 	{
           if (optinfo_enabled_p ())
             {
-              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-                               "not vectorized: base object not addressable "
-			       "for stmt: ");
+              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);
             }
           if (is_a <bb_vec_info> (vinfo))
@@ -4295,13 +4293,11 @@ again:
         {
           if (optinfo_enabled_p ())
             {
-              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: ");
-              dump_generic_expr (MSG_MISSED_OPTIMIZATION, TDF_DETAILS,
-                                 scalar_type);
-              dump_printf (MSG_MISSED_OPTIMIZATION, "\n");
+              EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		<< "not vectorized: no vectype for stmt: "
+		<< stmt
+		<< " scalar_type: "
+		<< details (scalar_type);
             }
 
           if (is_a <bb_vec_info> (vinfo))
@@ -4347,13 +4343,13 @@ again:
 	      free_data_ref (dr);
 	      if (optinfo_enabled_p ())
 		{
-		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE) << (
-				   (gatherscatter == GATHER) ?
-				   "not vectorized: not suitable for gather "
-				   "load " :
-				   "not vectorized: not suitable for scatter "
-				   "store ");
-		  dump_gimple_stmt (MSG_MISSED_OPTIMIZATION, TDF_SLIM, stmt, 0);
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		    << ((gatherscatter == GATHER) ?
+			"not vectorized: not suitable for gather "
+			"load " :
+			"not vectorized: not suitable for scatter "
+			"store ")
+		    << stmt;
 		}
 	      return false;
 	    }
@@ -4370,10 +4366,10 @@ again:
 	    {
 	      if (optinfo_enabled_p ())
 		{
-		  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);
+		  EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		    << ("not vectorized: not suitable for strided "
+			"load ")
+		    << stmt;
 		}
 	      return false;
 	    }
@@ -5057,9 +5053,9 @@ 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) << (
-			 "the size of the group of accesses"
-			 " is not a power of 2 or not eqaul to 3\n");
+	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");
       return false;
     }
 
@@ -5076,9 +5072,9 @@ 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) << (
-				 "cannot handle groups of 3 stores for"
-				 " variable-length vectors\n");
+		EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		  << ("cannot handle groups of 3 stores for"
+		      " variable-length vectors");
 	      return false;
 	    }
 
@@ -5103,8 +5099,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
 	      if (!can_vec_perm_const_p (mode, indices))
 		{
 		  if (optinfo_enabled_p ())
-		    dump_printf (MSG_MISSED_OPTIMIZATION,
-				 "permutation op not supported by target.\n");
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		      << "permutation op not supported by target";
 		  return false;
 		}
 
@@ -5121,8 +5117,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
 	      if (!can_vec_perm_const_p (mode, indices))
 		{
 		  if (optinfo_enabled_p ())
-		    dump_printf (MSG_MISSED_OPTIMIZATION,
-				 "permutation op not supported by target.\n");
+		    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+		      << "permutation op not supported by target";
 		  return false;
 		}
 	    }
@@ -5155,8 +5151,8 @@ vect_grouped_store_supported (tree vectype, unsigned HOST_WIDE_INT count)
     }
 
   if (optinfo_enabled_p ())
-    dump_printf (MSG_MISSED_OPTIMIZATION,
-		 "permutaion op not supported by target.\n");
+    EMIT_OPTINFO_AT_VECT_LOCATION (OPT_RECORD_FAILURE)
+      << "permutation op not supported by target";
   return false;
 }
 
-- 
1.8.5.3

