This also makes sure to consistently use vect_body for BB vectorization.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * tree-vect-loop.cc (vectorizable_live_operation): Cost
        the lane extract in vect_body for BB vectorization and
        in vect_epilog for loop vectorization.
---
 gcc/tree-vect-loop.cc | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index e94562ed5ed..e032f227270 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -10329,10 +10329,8 @@ vectorizable_live_operation (vec_info *vinfo, 
stmt_vec_info stmt_info,
                }
            }
        }
-      /* ???  Enable for loop costing as well.  */
-      if (!loop_vinfo)
-       record_stmt_cost (cost_vec, 1, vec_to_scalar, slp_node,
-                         0, vect_epilogue);
+      record_stmt_cost (cost_vec, 1, vec_to_scalar, slp_node,
+                       0, loop_vinfo ? vect_epilogue : vect_body);
       SLP_TREE_LIVE_LANES (slp_node).safe_push (slp_index);
       return true;
     }
-- 
2.51.0

Reply via email to