http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50133
Ira Rosen <irar at il dot ibm.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |irar at il dot ibm.com --- Comment #1 from Ira Rosen <irar at il dot ibm.com> 2011-08-21 06:02:10 UTC --- When creating a vector from an invariant scalar load, we do gsi_next (&gsi2); in order to insert the vector after the load. In this testcase the load is the last stmt in its basic block, which causes the failure when we try to call gsi_stmt(). This patch fixes the failure: Index: tree-vect-stmts.c =================================================================== --- tree-vect-stmts.c (revision 177929) +++ tree-vect-stmts.c (working copy) @@ -1435,6 +1435,9 @@ vect_finish_stmt_generation (gimple stmt, gimple v } si = *gsi; + if (gsi_end_p (si)) + si = gsi_for_stmt (stmt); + if (is_gimple_debug (gsi_stmt (si))) { gsi_next_nondebug (&si); but it's a hack. We could add a new parameter insert_after to vect_finish_stmt_generation (), to indicate that VECT_STMT should be inserted after GSI and not before. For this case we would have to pass it to vect_init_vector() first. Ira