From b1af7da61278d2c4ae7b7f56fad37723461031cb Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Wed, 27 May 2015 10:31:11 +0000 Subject: [PATCH] tree-vect-stmts.c (vectorizable_load): Initialize slp_perm earlier and remove ??? comment. 2015-05-27 Richard Biener * tree-vect-stmts.c (vectorizable_load): Initialize slp_perm earlier and remove ??? comment. (vect_analyze_stmt): If we are analyzing a pure SLP stmt and got called from loop analysis bail out. Always pass the SLP node to the vectorizable_* functions. * tree-vect-loop.c (vect_analyze_loop_operations): Remove the premature SLP check here. * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Dump hybrid detected SLP stmts. (vect_detect_hybrid_slp_1): Likewise. From-SVN: r223743 --- gcc/ChangeLog | 13 ++++++++ gcc/tree-vect-loop.c | 5 --- gcc/tree-vect-slp.c | 18 +++++++++-- gcc/tree-vect-stmts.c | 71 +++++++++++++++++++++++-------------------- 4 files changed, 67 insertions(+), 40 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index bf90c864206..ffde59c1584 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,16 @@ +2015-05-27 Richard Biener + + * tree-vect-stmts.c (vectorizable_load): Initialize slp_perm + earlier and remove ??? comment. + (vect_analyze_stmt): If we are analyzing a pure SLP stmt + and got called from loop analysis bail out. Always pass the SLP + node to the vectorizable_* functions. + * tree-vect-loop.c (vect_analyze_loop_operations): Remove + the premature SLP check here. + * tree-vect-slp.c (vect_detect_hybrid_slp_stmts): Dump hybrid + detected SLP stmts. + (vect_detect_hybrid_slp_1): Likewise. + 2015-05-26 Jeff Law * combine.c (find_split_point): Verify that the shift count is a diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 89202c425ed..b93685e8160 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -1556,11 +1556,6 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) gsi_next (&si)) { gimple stmt = gsi_stmt (si); - if (STMT_SLP_TYPE (vinfo_for_stmt (stmt))) - { - need_to_vectorize = true; - continue; - } if (!gimple_clobber_p (stmt) && !vect_analyze_stmt (stmt, &need_to_vectorize, NULL)) return false; diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c index 1e680207aed..214c96c7944 100644 --- a/gcc/tree-vect-slp.c +++ b/gcc/tree-vect-slp.c @@ -2027,7 +2027,14 @@ vect_detect_hybrid_slp_stmts (slp_tree node, unsigned i, slp_vect_type stype) } if (stype == hybrid) - STMT_SLP_TYPE (stmt_vinfo) = hybrid; + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_NOTE, vect_location, "marking hybrid: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, stmt, 0); + } + STMT_SLP_TYPE (stmt_vinfo) = hybrid; + } FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), j, child) if (child) @@ -2051,7 +2058,14 @@ vect_detect_hybrid_slp_1 (tree *tp, int *, void *data) gimple def_stmt = SSA_NAME_DEF_STMT (*tp); if (flow_bb_inside_loop_p (loopp, gimple_bb (def_stmt)) && PURE_SLP_STMT (vinfo_for_stmt (def_stmt))) - STMT_SLP_TYPE (vinfo_for_stmt (def_stmt)) = hybrid; + { + if (dump_enabled_p ()) + { + dump_printf_loc (MSG_NOTE, vect_location, "marking hybrid: "); + dump_gimple_stmt (MSG_NOTE, TDF_SLIM, def_stmt, 0); + } + STMT_SLP_TYPE (vinfo_for_stmt (def_stmt)) = hybrid; + } } return NULL_TREE; diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 83039f1ad39..06a59cb3995 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -5940,6 +5940,9 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, return false; } + if (slp && SLP_TREE_LOAD_PERMUTATION (slp_node).exists ()) + slp_perm = true; + group_size = GROUP_SIZE (vinfo_for_stmt (first_stmt)); if (!slp && !PURE_SLP_STMT (stmt_info) @@ -6004,10 +6007,7 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, && (slp || PURE_SLP_STMT (stmt_info))) && (group_size > nunits || nunits % group_size != 0 - /* ??? During analysis phase we are not called with the - slp node/instance we are in so whether we'll end up - with a permutation we don't know. Still we don't - support load permutations. */ + /* We don't support load permutations. */ || slp_perm)) { dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, @@ -6402,8 +6402,6 @@ vectorizable_load (gimple stmt, gimple_stmt_iterator *gsi, gimple *vec_stmt, { grouped_load = false; vec_num = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node); - if (SLP_TREE_LOAD_PERMUTATION (slp_node).exists ()) - slp_perm = true; group_gap = GROUP_GAP (vinfo_for_stmt (first_stmt)); } else @@ -7371,33 +7369,40 @@ vect_analyze_stmt (gimple stmt, bool *need_to_vectorize, slp_tree node) *need_to_vectorize = true; } - ok = true; - if (!bb_vinfo - && (STMT_VINFO_RELEVANT_P (stmt_info) - || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)) - ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, NULL) - || vectorizable_conversion (stmt, NULL, NULL, NULL) - || vectorizable_shift (stmt, NULL, NULL, NULL) - || vectorizable_operation (stmt, NULL, NULL, NULL) - || vectorizable_assignment (stmt, NULL, NULL, NULL) - || vectorizable_load (stmt, NULL, NULL, NULL, NULL) - || vectorizable_call (stmt, NULL, NULL, NULL) - || vectorizable_store (stmt, NULL, NULL, NULL) - || vectorizable_reduction (stmt, NULL, NULL, NULL) - || vectorizable_condition (stmt, NULL, NULL, NULL, 0, NULL)); - else - { - if (bb_vinfo) - ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node) - || vectorizable_conversion (stmt, NULL, NULL, node) - || vectorizable_shift (stmt, NULL, NULL, node) - || vectorizable_operation (stmt, NULL, NULL, node) - || vectorizable_assignment (stmt, NULL, NULL, node) - || vectorizable_load (stmt, NULL, NULL, node, NULL) - || vectorizable_call (stmt, NULL, NULL, node) - || vectorizable_store (stmt, NULL, NULL, node) - || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node)); - } + if (PURE_SLP_STMT (stmt_info) && !node) + { + dump_printf_loc (MSG_NOTE, vect_location, + "handled only by SLP analysis\n"); + return true; + } + + ok = true; + if (!bb_vinfo + && (STMT_VINFO_RELEVANT_P (stmt_info) + || STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)) + ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node) + || vectorizable_conversion (stmt, NULL, NULL, node) + || vectorizable_shift (stmt, NULL, NULL, node) + || vectorizable_operation (stmt, NULL, NULL, node) + || vectorizable_assignment (stmt, NULL, NULL, node) + || vectorizable_load (stmt, NULL, NULL, node, NULL) + || vectorizable_call (stmt, NULL, NULL, node) + || vectorizable_store (stmt, NULL, NULL, node) + || vectorizable_reduction (stmt, NULL, NULL, node) + || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node)); + else + { + if (bb_vinfo) + ok = (vectorizable_simd_clone_call (stmt, NULL, NULL, node) + || vectorizable_conversion (stmt, NULL, NULL, node) + || vectorizable_shift (stmt, NULL, NULL, node) + || vectorizable_operation (stmt, NULL, NULL, node) + || vectorizable_assignment (stmt, NULL, NULL, node) + || vectorizable_load (stmt, NULL, NULL, node, NULL) + || vectorizable_call (stmt, NULL, NULL, node) + || vectorizable_store (stmt, NULL, NULL, node) + || vectorizable_condition (stmt, NULL, NULL, NULL, 0, node)); + } if (!ok) { -- 2.30.2