http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50178
Ira Rosen <irar at il dot ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |irar at il dot ibm.com --- Comment #5 from Ira Rosen <irar at il dot ibm.com> 2011-09-01 07:01:07 UTC --- The problem here is that in vectorizable_call we replace the original call with a dummy stmt and also remove its stmt_vec_info, which causes the segfault when we try to access it through related pattern stmt. I'm testing the following patch that updates related pattern stmt to be the dummy stmt: Index: tree-vect-stmts.c =================================================================== --- tree-vect-stmts.c (revision 178373) +++ tree-vect-stmts.c (working copy) @@ -1583,6 +1583,14 @@ vectorizable_call (gimple stmt, gimple_stmt_iterat new_stmt = gimple_build_assign (gimple_call_lhs (stmt), build_zero_cst (type)); set_vinfo_for_stmt (new_stmt, stmt_info); + /* For pattern statements make the related statement to point to + NEW_STMT in order to be able to retrieve the original statement + information later. */ + if (is_pattern_stmt_p (stmt_info)) + { + gimple related = STMT_VINFO_RELATED_STMT (stmt_info); + STMT_VINFO_RELATED_STMT (vinfo_for_stmt (related)) = new_stmt; + } set_vinfo_for_stmt (stmt, NULL); STMT_VINFO_STMT (stmt_info) = new_stmt; gsi_replace (gsi, new_stmt, false); @@ -4957,11 +4965,7 @@ vect_transform_stmt (gimple stmt, gimple_stmt_iter the stmt_info of ORIG_STMT_IN_PATTERN. See more details in the documentation of vect_pattern_recog. */ if (STMT_VINFO_IN_PATTERN_P (stmt_vinfo)) - { - gcc_assert (STMT_VINFO_RELATED_STMT (stmt_vinfo) - == orig_scalar_stmt); - STMT_VINFO_VEC_STMT (stmt_vinfo) = vec_stmt; - } + STMT_VINFO_VEC_STMT (stmt_vinfo) = vec_stmt; } } r175074 really fixed this problem since now we don't need to retrieve the original def stmt.