[Bug tree-optimization/51058] [4.7 Regression] ICE: gimple check: expected gimple_assign(error_mark), have gimple_call() in gimple_assign_rhs_code, at gimple.h:1992
jakub at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Nov 10 19:00:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51058
--- Comment #9 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-11-10 18:40:05 UTC ---
The problem is that we have several SLP instances referring to the same call
stmt, so vectorizable_call is called on the same stmt several times.
But vectorizable_call wants to replace the scalar call with a assignment and
when it does the first time it is called, we get a segfault the second time
because the original scalar call stmt has bb set to NULL by gsi_replace.
--- gcc/tree-vect-stmts.c.jj 12011-11-10 18:09:12.000000000 +0100
+++ gcc/tree-vect-stmts.c 2011-11-10 18:44:07.135949119 +0100
@@ -1886,6 +1886,9 @@ vectorizable_call (gimple stmt, gimple_s
it defines is mapped to the new definition. So just replace
rhs of the statement with something harmless. */
+ if (slp_node)
+ return true;
+
type = TREE_TYPE (scalar_dest);
if (is_pattern_stmt_p (stmt_info))
lhs = gimple_call_lhs (STMT_VINFO_RELATED_STMT (stmt_info));
@@ -1893,8 +1896,7 @@ vectorizable_call (gimple stmt, gimple_s
lhs = gimple_call_lhs (stmt);
new_stmt = gimple_build_assign (lhs, build_zero_cst (type));
set_vinfo_for_stmt (new_stmt, stmt_info);
- if (!slp_node)
- set_vinfo_for_stmt (stmt, NULL);
+ set_vinfo_for_stmt (stmt, NULL);
STMT_VINFO_STMT (stmt_info) = new_stmt;
gsi_replace (gsi, new_stmt, false);
SSA_NAME_DEF_STMT (gimple_assign_lhs (new_stmt)) = new_stmt;
patch fixes the ICE, but then the scalar stmt stays in the tree at the end of
*.vect pass (and at least in this case is DCEd afterwards).
If we wanted to do this replacement, I guess we could do that from
vect_schedule_slp after all vect_schedule_slp_instance calls have returned, but
we'd need to again recursively go through the instance tree.
More information about the Gcc-bugs
mailing list