diff options
author | Richard Biener <rguenther@suse.de> | 2015-11-06 11:15:40 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2015-11-06 11:15:40 +0000 |
commit | 61d371eb413e6917f59bea804b3c167e31f88f98 (patch) | |
tree | 74dcc1ae8899af0f2b008c2052a07e430f301776 /gcc/tree-vect-patterns.c | |
parent | 66a5f0b45ff2dc172035f896903d846a6f86e8d0 (diff) | |
download | gcc-61d371eb413e6917f59bea804b3c167e31f88f98.zip gcc-61d371eb413e6917f59bea804b3c167e31f88f98.tar.gz gcc-61d371eb413e6917f59bea804b3c167e31f88f98.tar.bz2 |
tree-vectorizer.h (struct _bb_vec_info): Add region_begin/end members.
2015-11-06 Richard Biener <rguenther@suse.de>
* tree-vectorizer.h (struct _bb_vec_info): Add region_begin/end
members.
(vect_stmt_in_region_p): Declare.
* tree-vect-slp.c (new_bb_vec_info): Work on a region.
(destroy_bb_vec_info): Likewise.
(vect_bb_slp_scalar_cost): Use vect_stmt_in_region_p.
(vect_get_and_check_slp_defs): Likewise.
(vect_slp_analyze_bb_1): Refactor to make it work on sub-BBs.
(vect_slp_bb): Likewise.
* tree-vect-patterns.c (vect_same_loop_or_bb_p): Implement
in terms of vect_stmt_in_region_p.
(vect_pattern_recog): Iterate over the BB region.
* tree-vect-stmts.c (vect_is_simple_use): Use vect_stmt_in_region_p.
* tree-vectorizer.c (vect_stmt_in_region_p): New function.
(pass_slp_vectorize::execute): Initialize all stmt UIDs to -1.
* config/i386/i386.c: Include gimple-iterator.h.
* config/aarch64/aarch64.c: Likewise.
* gcc.dg/vect/bb-slp-38.c: New testcase.
From-SVN: r229842
Diffstat (limited to 'gcc/tree-vect-patterns.c')
-rw-r--r-- | gcc/tree-vect-patterns.c | 69 |
1 files changed, 29 insertions, 40 deletions
diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index f1de690..d003d33 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -107,27 +107,7 @@ static bool vect_same_loop_or_bb_p (gimple *stmt1, gimple *stmt2) { stmt_vec_info stmt_vinfo = vinfo_for_stmt (stmt1); - loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); - bb_vec_info bb_vinfo = STMT_VINFO_BB_VINFO (stmt_vinfo); - - if (!gimple_bb (stmt2)) - return false; - - if (loop_vinfo) - { - struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); - if (!flow_bb_inside_loop_p (loop, gimple_bb (stmt2))) - return false; - } - else - { - if (gimple_bb (stmt2) != BB_VINFO_BB (bb_vinfo) - || gimple_code (stmt2) == GIMPLE_PHI) - return false; - } - - gcc_assert (vinfo_for_stmt (stmt2)); - return true; + return vect_stmt_in_region_p (stmt_vinfo->vinfo, stmt2); } /* If the LHS of DEF_STMT has a single use, and that statement is @@ -3611,33 +3591,42 @@ vect_pattern_recog (vec_info *vinfo) loop = LOOP_VINFO_LOOP (loop_vinfo); bbs = LOOP_VINFO_BBS (loop_vinfo); nbbs = loop->num_nodes; + + /* Scan through the loop stmts, applying the pattern recognition + functions starting at each stmt visited: */ + for (i = 0; i < nbbs; i++) + { + basic_block bb = bbs[i]; + for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) + { + /* Scan over all generic vect_recog_xxx_pattern functions. */ + for (j = 0; j < NUM_PATTERNS; j++) + { + vect_recog_func = vect_vect_recog_func_ptrs[j]; + vect_pattern_recog_1 (vect_recog_func, si, + &stmts_to_replace); + } + } + } } else { - bbs = &as_a <bb_vec_info> (vinfo)->bb; - nbbs = 1; - } - - /* Scan through the loop stmts, applying the pattern recognition - functions starting at each stmt visited: */ - for (i = 0; i < nbbs; i++) - { - basic_block bb = bbs[i]; - for (si = gsi_start_bb (bb); !gsi_end_p (si); gsi_next (&si)) - { - if (is_a <bb_vec_info> (vinfo) - && (stmt = gsi_stmt (si)) + bb_vec_info bb_vinfo = as_a <bb_vec_info> (vinfo); + for (si = bb_vinfo->region_begin; + gsi_stmt (si) != gsi_stmt (bb_vinfo->region_end); gsi_next (&si)) + { + if ((stmt = gsi_stmt (si)) && vinfo_for_stmt (stmt) && !STMT_VINFO_VECTORIZABLE (vinfo_for_stmt (stmt))) - continue; + continue; - /* Scan over all generic vect_recog_xxx_pattern functions. */ - for (j = 0; j < NUM_PATTERNS; j++) - { + /* Scan over all generic vect_recog_xxx_pattern functions. */ + for (j = 0; j < NUM_PATTERNS; j++) + { vect_recog_func = vect_vect_recog_func_ptrs[j]; vect_pattern_recog_1 (vect_recog_func, si, &stmts_to_replace); - } - } + } + } } } |