Patchwork opt-info message change for vectorizer

login
register
mail settings
Submitter Xinliang David Li
Date Aug. 28, 2013, 6:14 p.m.
Message ID <CAAkRFZJfVWyFzcrsQ=Nmuf6wqCuM6A=c7KrL5A_qCj3-e8SSKg@mail.gmail.com>
Download mbox | patch
Permalink /patch/270614/
State New
Headers show

Comments

Xinliang David Li - Aug. 28, 2013, 6:14 p.m.
Fixed as requested. I don't like the extra newline either, but I will
leave that to Teresa.

basic3.c:8:foo: note: loop vectorized

basic3.c:8:foo: note: loop versioned for vectorization because of
possible aliasing

basic3.c:8:foo: note: loop peeled for vectorization to enhance alignment

basic3.c:8:foo: note: loop with 7 iterations completely unrolled

basic3.c:5:foo: note: loop with 7 iterations completely unrolled


Is this version ok after testing?

thanks,

David

On Wed, Aug 28, 2013 at 2:45 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Tue, Aug 27, 2013 at 10:30 PM, Xinliang David Li <davidxl@google.com> wrote:
>> If this is the convention, we should probably have another patch to
>> fix all the existing opt-info messages.
>
> Yes please.
>
> Also ...
>
>
>>>>> b.c:16:A::foo: note: Loop is vectorized
>
> "loop vectorized"
>
>>>>>
>>>>> b.c:16:A::foo: note: Loop is versioned to remove aliases for vectorization
>
> "loop versioned for vectorization because of possible aliasing"
>
>>>>> b.c:16:A::foo: note: Loop is peeled to enhance alignment for vectorization
>
> "loop peeled for vectorization to enhance alignment"
>
>>>>> b.c:16:A::foo: note: Completely unroll loop 6 times
>
> maybe "loop with 6 iterations completely unrolled"
>
>>>>>
>>>>> b.c:12:A::foo: note: Completely unroll loop 6 times
>>>>>
>
> I hate the excessive vertical spacing as well.
>
> Richard.
>
>>>>> Ok after testing?
>>>>>
>>>>> thanks,
>>>>>
>>>>> David
>>>

Patch

Index: tree-vectorizer.c
===================================================================
--- tree-vectorizer.c	(revision 201751)
+++ tree-vectorizer.c	(working copy)
@@ -119,7 +119,7 @@  vectorize_loops (void)
         if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
 	    && dump_enabled_p ())
           dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
-                           "Vectorized loop\n");
+                           "loop vectorized\n");
 	vect_transform_loop (loop_vinfo);
 	num_vectorized_loops++;
       }
@@ -180,7 +180,7 @@  execute_vect_slp (void)
           vect_slp_transform_bb (bb);
           if (dump_enabled_p ())
             dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
-			     "Vectorized basic-block\n");
+			     "Basic block is vectorized\n");
         }
     }
 
Index: loop-unroll.c
===================================================================
--- loop-unroll.c	(revision 201751)
+++ loop-unroll.c	(working copy)
@@ -225,7 +225,7 @@  report_unroll_peel (struct loop *loop, l
       && !loop->lpt_decision.times)
     {
       dump_printf_loc (report_flags, locus,
-                       "Turned loop into non-loop; it never loops.\n");
+                       "loop turned into non-loop; it never loops.\n");
       return;
     }
 
@@ -236,13 +236,16 @@  report_unroll_peel (struct loop *loop, l
   else if (loop->header->count)
     niters = expected_loop_iterations (loop);
 
-  dump_printf_loc (report_flags, locus,
-                   "%s loop %d times",
-                   (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY
-                    ?  "Completely unroll"
-                    : (loop->lpt_decision.decision == LPT_PEEL_SIMPLE
-                       ? "Peel" : "Unroll")),
-                   loop->lpt_decision.times);
+  if (loop->lpt_decision.decision == LPT_PEEL_COMPLETELY)
+    dump_printf_loc (report_flags, locus,
+                     "loop with %d iterations completely unrolled",
+		     loop->lpt_decision.times + 1);
+  else
+    dump_printf_loc (report_flags, locus,
+                     "loop %s %d times",
+                     (loop->lpt_decision.decision == LPT_PEEL_SIMPLE
+                       ? "peeled" : "unrolled"),
+                     loop->lpt_decision.times);
   if (profile_info)
     dump_printf (report_flags,
                  " (header execution count %d",
Index: dumpfile.c
===================================================================
--- dumpfile.c	(revision 201751)
+++ dumpfile.c	(working copy)
@@ -24,6 +24,7 @@  along with GCC; see the file COPYING3.
 #include "dumpfile.h"
 #include "gimple-pretty-print.h"
 #include "tree.h"
+#include "gimple.h"
 
 /* If non-NULL, return one past-the-end of the matching SUBPART of
    the WHOLE string.  */
@@ -261,12 +262,20 @@  dump_loc (int dump_kind, FILE *dfile, so
   if (dump_kind)
     {
       if (LOCATION_LOCUS (loc) > BUILTINS_LOCATION)
-        fprintf (dfile, "\n%s:%d: note: ", LOCATION_FILE (loc),
-                 LOCATION_LINE (loc));
+        {
+          if (current_function_decl)
+            fprintf (dfile, "\n%s:%d:%s: note: ", LOCATION_FILE (loc),
+                     LOCATION_LINE (loc),
+                     gimple_decl_printable_name (current_function_decl, 1));
+          else
+            fprintf (dfile, "\n%s:%d: note: ", LOCATION_FILE (loc),
+                     LOCATION_LINE (loc));
+        }
       else if (current_function_decl)
-        fprintf (dfile, "\n%s:%d: note: ",
+        fprintf (dfile, "\n%s:%d:%s: note: ",
                  DECL_SOURCE_FILE (current_function_decl),
-                 DECL_SOURCE_LINE (current_function_decl));
+                 DECL_SOURCE_LINE (current_function_decl),
+                 gimple_decl_printable_name (current_function_decl, 1));
     }
 }
 
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 201752)
+++ ChangeLog	(working copy)
@@ -1,3 +1,13 @@ 
+2013-08-22  Xinliang David Li  <davidxl@google.com>
+
+	* tree-vect-loop-manip.c (vect_do_peeling_for_alignment):
+	Emit alignment peeling message with default -fopt-info.
+	(vect_loop_versioning): Emit loop version info message.
+	* tree-vectorizer.c (vectorize_loops): Minor message
+	change.
+	(execute_vect_slp): Ditto.
+	* dumpfile.c (dump_loc): Add function name in the dump.
+
 2013-08-14  Xinliang David Li  <davidxl@google.com>
 
 	* config/i386/i386.c (ix86_option_override_internal):
Index: tree-vect-loop-manip.c
===================================================================
--- tree-vect-loop-manip.c	(revision 201751)
+++ tree-vect-loop-manip.c	(working copy)
@@ -2021,8 +2021,9 @@  vect_do_peeling_for_alignment (loop_vec_
   int bound = 0;
 
   if (dump_enabled_p ())
-    dump_printf_loc (MSG_NOTE, vect_location,
-                     "=== vect_do_peeling_for_alignment ===");
+    dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+                     "loop peeled for vectorization to enhance"
+                     " alignment\n");
 
   initialize_original_copy_tables ();
 
@@ -2404,6 +2405,8 @@  vect_loop_versioning (loop_vec_info loop
   unsigned prob = 4 * REG_BR_PROB_BASE / 5;
   gimple_seq gimplify_stmt_list = NULL;
   tree scalar_loop_iters = LOOP_VINFO_NITERS (loop_vinfo);
+  bool version_align = LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo);
+  bool version_alias = LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo);
 
   if (check_profitability)
     {
@@ -2413,11 +2416,11 @@  vect_loop_versioning (loop_vec_info loop
 					  is_gimple_condexpr, NULL_TREE);
     }
 
-  if (LOOP_REQUIRES_VERSIONING_FOR_ALIGNMENT (loop_vinfo))
+  if (version_align)
     vect_create_cond_for_align_checks (loop_vinfo, &cond_expr,
 				       &cond_expr_stmt_list);
 
-  if (LOOP_REQUIRES_VERSIONING_FOR_ALIAS (loop_vinfo))
+  if (version_alias)
     vect_create_cond_for_alias_checks (loop_vinfo, &cond_expr);
 
   cond_expr = force_gimple_operand_1 (cond_expr, &gimplify_stmt_list,
@@ -2427,6 +2430,20 @@  vect_loop_versioning (loop_vec_info loop
   initialize_original_copy_tables ();
   loop_version (loop, cond_expr, &condition_bb,
 		prob, prob, REG_BR_PROB_BASE - prob, true);
+
+  if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOC
+      && dump_enabled_p ())
+    {
+      if (version_alias)
+        dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+                         "loop versioned for vectorization because of "
+			 "possible aliasing\n");
+      if (version_align)
+        dump_printf_loc (MSG_OPTIMIZED_LOCATIONS, vect_location,
+                         "loop versioned for vectorization to enhance "
+			 "alignment\n");
+
+    }
   free_original_copy_tables();
 
   /* Loop versioning violates an assumption we try to maintain during
Index: tree-vect-data-refs.c
===================================================================
--- tree-vect-data-refs.c	(revision 201751)
+++ tree-vect-data-refs.c	(working copy)
@@ -37,7 +37,7 @@  along with GCC; see the file COPYING3.
 #include "tree-scalar-evolution.h"
 #include "tree-vectorizer.h"
 #include "diagnostic-core.h"
-
+#include <stdlib.h>
 /* Need to include rtl.h, expr.h, etc. for optabs.  */
 #include "expr.h"
 #include "optabs.h"
@@ -1393,6 +1393,8 @@  vect_enhance_data_refs_alignment (loop_v
 
       supportable_dr_alignment = vect_supportable_dr_alignment (dr, true);
       do_peeling = vector_alignment_reachable_p (dr);
+      if (getenv("NOPEEL")) 
+        do_peeling = false;
       if (do_peeling)
         {
           if (known_alignment_for_access_p (dr))
Index: tree-ssa-loop-ivcanon.c
===================================================================
--- tree-ssa-loop-ivcanon.c	(revision 201751)
+++ tree-ssa-loop-ivcanon.c	(working copy)
@@ -870,11 +870,12 @@  try_unroll_loop_completely (struct loop
     {
       if (!n_unroll)
         dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, locus,
-                         "Turned loop into non-loop; it never loops.\n");
+                         "loop turned into non-loop; it never loops.\n");
       else
         {
           dump_printf_loc (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS, locus,
-                           "Completely unroll loop %d times", (int)n_unroll);
+                           "loop with %d iterations completely unrolled",
+			   (int) (n_unroll + 1));
           if (profile_info)
             dump_printf (MSG_OPTIMIZED_LOCATIONS | TDF_DETAILS,
                          " (header execution count %d)",