diff mbox series

vect: Tweak dump messages for vector mode choice

Message ID mpt5ywmbtav.fsf@arm.com
State New
Headers show
Series vect: Tweak dump messages for vector mode choice | expand

Commit Message

Richard Sandiford Aug. 3, 2021, 12:34 p.m. UTC
After vect_analyze_loop has successfully analysed a loop for
one base vector mode B1, it considers using following base vector
modes to vectorise an epilogue.  However, for VECT_COMPARE_COSTS,
a later mode B2 might turn out to be better than B1 was.  Initially
this comparison will be between an epilogue loop (for B2) and a main
loop (for B1).  However, in r11-6458 I'd added code to reanalyse the
B2 epilogue loop as a main loop, partly for correctness and partly
for better costing.

This can lead to a situation in which we think that the B2 epilogue
loop was better than the B1 main loop, but that the B2 main loop is
not better than the B1 main loop.  There was no dump message to say
that this had happened, which made it look like B2 had still won.

Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


gcc/
	* tree-vect-loop.c (vect_analyze_loop): Print a dump message
	when a reanalyzed loop fails to be cheaper than the current
	main loop.
---
 gcc/tree-vect-loop.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

Comments

Richard Biener Aug. 3, 2021, 1:05 p.m. UTC | #1
On Tue, Aug 3, 2021 at 2:35 PM Richard Sandiford via Gcc-patches
<gcc-patches@gcc.gnu.org> wrote:
>
> After vect_analyze_loop has successfully analysed a loop for
> one base vector mode B1, it considers using following base vector
> modes to vectorise an epilogue.  However, for VECT_COMPARE_COSTS,
> a later mode B2 might turn out to be better than B1 was.  Initially
> this comparison will be between an epilogue loop (for B2) and a main
> loop (for B1).  However, in r11-6458 I'd added code to reanalyse the
> B2 epilogue loop as a main loop, partly for correctness and partly
> for better costing.
>
> This can lead to a situation in which we think that the B2 epilogue
> loop was better than the B1 main loop, but that the B2 main loop is
> not better than the B1 main loop.  There was no dump message to say
> that this had happened, which made it look like B2 had still won.
>
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

OK.

> Richard
>
>
> gcc/
>         * tree-vect-loop.c (vect_analyze_loop): Print a dump message
>         when a reanalyzed loop fails to be cheaper than the current
>         main loop.
> ---
>  gcc/tree-vect-loop.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
> index 00a57b2ba62..48a54b0957f 100644
> --- a/gcc/tree-vect-loop.c
> +++ b/gcc/tree-vect-loop.c
> @@ -3064,7 +3064,16 @@ vect_analyze_loop (class loop *loop, vec_info_shared *shared)
>                         = opt_loop_vec_info::success (main_loop_vinfo);
>                     }
>                   else
> -                   delete main_loop_vinfo;
> +                   {
> +                     if (dump_enabled_p ())
> +                       dump_printf_loc (MSG_NOTE, vect_location,
> +                                        "***** No longer preferring vector"
> +                                        " mode %s after reanalyzing the loop"
> +                                        " as a main loop\n",
> +                                        GET_MODE_NAME
> +                                          (main_loop_vinfo->vector_mode));
> +                     delete main_loop_vinfo;
> +                   }
>                 }
>             }
>
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 00a57b2ba62..48a54b0957f 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3064,7 +3064,16 @@  vect_analyze_loop (class loop *loop, vec_info_shared *shared)
 			= opt_loop_vec_info::success (main_loop_vinfo);
 		    }
 		  else
-		    delete main_loop_vinfo;
+		    {
+		      if (dump_enabled_p ())
+			dump_printf_loc (MSG_NOTE, vect_location,
+					 "***** No longer preferring vector"
+					 " mode %s after reanalyzing the loop"
+					 " as a main loop\n",
+					 GET_MODE_NAME
+					   (main_loop_vinfo->vector_mode));
+		      delete main_loop_vinfo;
+		    }
 		}
 	    }