vec: Revert "dead code removal in tree-vect-loop.c" and add a comment.

Message ID gkra6y136nu.fsf_-_@arm.com
State New
Headers show
Series
  • vec: Revert "dead code removal in tree-vect-loop.c" and add a comment.
Related show

Commit Message

Andrea Corallo Sept. 7, 2020, 4:15 p.m.
Hi Richard,

this reverts the discussed patch and adds what was suggested as a
comment.

Apologies for the inconvenience, okay for trunk?

Thanks

  Andrea
From 84dfa2d461692f445f45b3c3498f9bedba5c3848 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <andrea.corallo@arm.com>

Date: Mon, 7 Sep 2020 13:45:47 +0100
Subject: [PATCH] vec: Revert "dead code removal in tree-vect-loop.c" and add a
 comment.

gcc/ChangeLog

2020-09-07  Andrea Corallo  <andrea.corallo@arm.com>

	* tree-vect-loop.c (vect_estimate_min_profitable_iters): Revert
	dead-code removal introduced by 09fa6acd8d9 + add a comment to
	clarify.
---
 gcc/tree-vect-loop.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

-- 
2.17.1

Comments

Richard Sandiford Sept. 7, 2020, 5:20 p.m. | #1
Andrea Corallo <andrea.corallo@arm.com> writes:
> Hi Richard,

>

> this reverts the discussed patch and adds what was suggested as a

> comment.

>

> Apologies for the inconvenience, okay for trunk?


OK, thanks!  And sorry for not commenting/documenting this very well.

Richard

>

> Thanks

>

>   Andrea

>

> From 84dfa2d461692f445f45b3c3498f9bedba5c3848 Mon Sep 17 00:00:00 2001

> From: Andrea Corallo <andrea.corallo@arm.com>

> Date: Mon, 7 Sep 2020 13:45:47 +0100

> Subject: [PATCH] vec: Revert "dead code removal in tree-vect-loop.c" and add a

>  comment.

>

> gcc/ChangeLog

>

> 2020-09-07  Andrea Corallo  <andrea.corallo@arm.com>

>

> 	* tree-vect-loop.c (vect_estimate_min_profitable_iters): Revert

> 	dead-code removal introduced by 09fa6acd8d9 + add a comment to

> 	clarify.

> ---

>  gcc/tree-vect-loop.c | 17 +++++++++++++----

>  1 file changed, 13 insertions(+), 4 deletions(-)

>

> diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c

> index 9a82573604b..5ba4e594df9 100644

> --- a/gcc/tree-vect-loop.c

> +++ b/gcc/tree-vect-loop.c

> @@ -4103,6 +4103,8 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,

>  

>    if (vec_outside_cost <= 0)

>      min_profitable_estimate = 0;

> +  /* ??? This "else if" arm is written to handle all cases; see below for

> +     what we would do for !LOOP_VINFO_USING_PARTIAL_VECTORS_P.  */

>    else if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))

>      {

>        /* This is a repeat of the code above, but with + SOC rather

> @@ -4115,10 +4117,17 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,

>        if (outside_overhead > 0)

>  	min_vec_niters = outside_overhead / saving_per_viter + 1;

>  

> -      int threshold = (vec_inside_cost * min_vec_niters

> -		       + vec_outside_cost

> -		       + scalar_outside_cost);

> -      min_profitable_estimate = threshold / scalar_single_iter_cost + 1;

> +      if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))

> +	{

> +	  int threshold = (vec_inside_cost * min_vec_niters

> +			   + vec_outside_cost

> +			   + scalar_outside_cost);

> +	  min_profitable_estimate = threshold / scalar_single_iter_cost + 1;

> +	}

> +      else

> +	min_profitable_estimate = (min_vec_niters * assumed_vf

> +				   + peel_iters_prologue

> +				   + peel_iters_epilogue);

>      }

>    else

>      {
Andrea Corallo Sept. 7, 2020, 5:55 p.m. | #2
Richard Sandiford <richard.sandiford@arm.com> writes:

> Andrea Corallo <andrea.corallo@arm.com> writes:

>> Hi Richard,

>>

>> this reverts the discussed patch and adds what was suggested as a

>> comment.

>>

>> Apologies for the inconvenience, okay for trunk?

>

> OK, thanks!  And sorry for not commenting/documenting this very well.

>

> Richard


Installed as e147bb0faad.

Thanks
  Andrea

Patch

diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 9a82573604b..5ba4e594df9 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -4103,6 +4103,8 @@  vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
 
   if (vec_outside_cost <= 0)
     min_profitable_estimate = 0;
+  /* ??? This "else if" arm is written to handle all cases; see below for
+     what we would do for !LOOP_VINFO_USING_PARTIAL_VECTORS_P.  */
   else if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
     {
       /* This is a repeat of the code above, but with + SOC rather
@@ -4115,10 +4117,17 @@  vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
       if (outside_overhead > 0)
 	min_vec_niters = outside_overhead / saving_per_viter + 1;
 
-      int threshold = (vec_inside_cost * min_vec_niters
-		       + vec_outside_cost
-		       + scalar_outside_cost);
-      min_profitable_estimate = threshold / scalar_single_iter_cost + 1;
+      if (LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo))
+	{
+	  int threshold = (vec_inside_cost * min_vec_niters
+			   + vec_outside_cost
+			   + scalar_outside_cost);
+	  min_profitable_estimate = threshold / scalar_single_iter_cost + 1;
+	}
+      else
+	min_profitable_estimate = (min_vec_niters * assumed_vf
+				   + peel_iters_prologue
+				   + peel_iters_epilogue);
     }
   else
     {