From: rsandifo Date: Wed, 20 Jun 2018 08:06:33 +0000 (+0000) Subject: [3/n] PR85694: Fix dummy assignment handling in vectorizable_call X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d1055d7bd74eb3eeb0b8ca1d658d13197034860f;p=thirdparty%2Fgcc.git [3/n] PR85694: Fix dummy assignment handling in vectorizable_call vectorizable_call stubs out the original scalar statement with a dummy assignment to the same lhs, so that we don't leave any bogus scalar calls around. If the call is actually a pattern statement, the code rightly took the lhs of the original bb statement: if (is_pattern_stmt_p (stmt_info)) lhs = gimple_call_lhs (STMT_VINFO_RELATED_STMT (stmt_info)); else lhs = gimple_call_lhs (stmt); But it then associated the new statement with the stmt_vec_info of the pattern statement rather than the bb statement, which meant we had two stmt_vec_infos assigning to the same lhs. This seems to be latent at the moment but caused problems further into the series. 2018-06-20 Richard Sandiford gcc/ * tree-vect-stmts.c (vectorizable_call): Make sure that we use the stmt_vec_info of the original bb statement for the new zero assignment, even if the call is part of a pattern. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@261786 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 09ab7d8c3a4b..e55c67b9e141 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2018-06-20 Richard Sandiford + + * tree-vect-stmts.c (vectorizable_call): Make sure that we + use the stmt_vec_info of the original bb statement for the + new zero assignment, even if the call is part of a pattern. + 2018-06-20 Richard Sandiford * tree-vectorizer.h (_stmt_vec_info): Note above pattern_def_seq diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index af58d918cdbb..1181bc9d3dad 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -3605,13 +3605,12 @@ vectorizable_call (gimple *gs, gimple_stmt_iterator *gsi, gimple **vec_stmt, type = TREE_TYPE (scalar_dest); if (is_pattern_stmt_p (stmt_info)) - lhs = gimple_call_lhs (STMT_VINFO_RELATED_STMT (stmt_info)); - else - lhs = gimple_call_lhs (stmt); + stmt_info = vinfo_for_stmt (STMT_VINFO_RELATED_STMT (stmt_info)); + lhs = gimple_get_lhs (stmt_info->stmt); new_stmt = gimple_build_assign (lhs, build_zero_cst (type)); set_vinfo_for_stmt (new_stmt, stmt_info); - set_vinfo_for_stmt (stmt, NULL); + set_vinfo_for_stmt (stmt_info->stmt, NULL); STMT_VINFO_STMT (stmt_info) = new_stmt; gsi_replace (gsi, new_stmt, false);