diff options
author | Dorit Nuzman <dorit@il.ibm.com> | 2008-12-30 06:58:57 +0000 |
---|---|---|
committer | Ira Rosen <irar@gcc.gnu.org> | 2008-12-30 06:58:57 +0000 |
commit | 7f5c5702cad70ae6ac0d90178d9a91096f97253d (patch) | |
tree | 400c8e032ea4bf174b1c2f04975882457f9b370d /gcc/tree-vect-transform.c | |
parent | b72bc5243fdc2830e2e4290526d43d210ff3178a (diff) | |
download | gcc-7f5c5702cad70ae6ac0d90178d9a91096f97253d.zip gcc-7f5c5702cad70ae6ac0d90178d9a91096f97253d.tar.gz gcc-7f5c5702cad70ae6ac0d90178d9a91096f97253d.tar.bz2 |
re PR tree-optimization/38529 (ICE with nested loops)
PR tree-optimization/38529
* tree-vect-transform (vect_transform_stmt): Handle inner-loop stmts
whose DEF is used in the loop-nest that is being vectorized, but
outside the immediately enclosing loop.
Co-Authored-By: Ira Rosen <irar@il.ibm.com>
From-SVN: r142959
Diffstat (limited to 'gcc/tree-vect-transform.c')
-rw-r--r-- | gcc/tree-vect-transform.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gcc/tree-vect-transform.c b/gcc/tree-vect-transform.c index 18c22e7..2db0167 100644 --- a/gcc/tree-vect-transform.c +++ b/gcc/tree-vect-transform.c @@ -7047,6 +7047,8 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi, stmt_vec_info stmt_info = vinfo_for_stmt (stmt); gimple orig_stmt_in_pattern; bool done; + loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); + struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); switch (STMT_VINFO_TYPE (stmt_info)) { @@ -7130,6 +7132,43 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iterator *gsi, } } + /* Handle inner-loop stmts whose DEF is used in the loop-nest that + is being vectorized, but outside the immediately enclosing loop. */ + if (vec_stmt + && nested_in_vect_loop_p (loop, stmt) + && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type + && (STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_outer + || STMT_VINFO_RELEVANT (stmt_info) == vect_used_in_outer_by_reduction)) + { + struct loop *innerloop = loop->inner; + imm_use_iterator imm_iter; + use_operand_p use_p; + tree scalar_dest; + gimple exit_phi; + + if (vect_print_dump_info (REPORT_DETAILS)) + fprintf (vect_dump, "Record the vdef for outer-loop vectorization."); + + /* Find the relevant loop-exit phi-node, and reord the vec_stmt there + (to be used when vectorizing outer-loop stmts that use the DEF of + STMT). */ + if (gimple_code (stmt) == GIMPLE_PHI) + scalar_dest = PHI_RESULT (stmt); + else + scalar_dest = gimple_assign_lhs (stmt); + + FOR_EACH_IMM_USE_FAST (use_p, imm_iter, scalar_dest) + { + if (!flow_bb_inside_loop_p (innerloop, gimple_bb (USE_STMT (use_p)))) + { + exit_phi = USE_STMT (use_p); + STMT_VINFO_VEC_STMT (vinfo_for_stmt (exit_phi)) = vec_stmt; + } + } + } + + /* Handle stmts whose DEF is used outside the loop-nest that is + being vectorized. */ if (STMT_VINFO_LIVE_P (stmt_info) && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type) { |