vec: Revert "dead code removal in tree-vect-loop.c" and add a comment.
authorAndrea Corallo <andrea.corallo@arm.com>
Mon, 7 Sep 2020 12:45:47 +0000 (13:45 +0100)
committerAndrea Corallo <andrea.corallo@arm.com>
Mon, 7 Sep 2020 17:49:25 +0000 (19:49 +0200)
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

index a0c3c5cc858fef99f734500d86a32e2f74966d56..80e78f7adf4d1cbc279a63831d72b57176d58470 100644 (file)
@@ -4089,6 +4089,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
@@ -4101,10 +4103,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
     {