This aovids falling back to the loop root node when handling
a VEC_PERM node.

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

        * tree-vect-slp.cc (vect_optimize_slp_pass::containing_loop):
        For nodes w/o representative use the region entry block
        to indicate the containing loop.
---
 gcc/tree-vect-slp.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index c86481e4f28..e7aff6565bf 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -6903,7 +6903,7 @@ vect_optimize_slp_pass::containing_loop (slp_tree node)
 {
   stmt_vec_info rep = SLP_TREE_REPRESENTATIVE (node);
   if (!rep)
-    return ENTRY_BLOCK_PTR_FOR_FN (cfun)->loop_father;
+    return m_vinfo->bbs[0]->loop_father;
   return gimple_bb (vect_orig_stmt (rep)->stmt)->loop_father;
 }
 
-- 
2.51.0

Reply via email to