2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
+ * tree-vectorizer.h (vec_info::remove_stmt): Declare.
+ * tree-vectorizer.c (vec_info::remove_stmt): New function.
+ * tree-vect-loop-manip.c (vect_set_loop_condition): Use it.
+ * tree-vect-loop.c (vect_transform_loop): Likewise.
+ * tree-vect-slp.c (vect_schedule_slp): Likewise.
+ * tree-vect-stmts.c (vect_remove_stores): Likewise.
+
+2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
+
* tree-vectorizer.h (vec_info::lookup_dr): New member function.
(vect_dr_stmt): Delete.
* tree-vectorizer.c (vec_info::lookup_dr): New function.
loop_cond_gsi);
/* Remove old loop exit test. */
- gsi_remove (&loop_cond_gsi, true);
- free_stmt_vec_info (orig_cond);
+ stmt_vec_info orig_cond_info;
+ if (loop_vinfo
+ && (orig_cond_info = loop_vinfo->lookup_stmt (orig_cond)))
+ loop_vinfo->remove_stmt (orig_cond_info);
+ else
+ gsi_remove (&loop_cond_gsi, true);
if (dump_enabled_p ())
{
vect_transform_loop_stmt (loop_vinfo, stmt_info, &si,
&seen_store, &slp_scheduled);
}
+ gsi_next (&si);
if (seen_store)
{
if (STMT_VINFO_GROUPED_ACCESS (seen_store))
- {
- /* Interleaving. If IS_STORE is TRUE, the
- vectorization of the interleaving chain was
- completed - free all the stores in the chain. */
- gsi_next (&si);
- vect_remove_stores (DR_GROUP_FIRST_ELEMENT (seen_store));
- }
+ /* Interleaving. If IS_STORE is TRUE, the
+ vectorization of the interleaving chain was
+ completed - free all the stores in the chain. */
+ vect_remove_stores (DR_GROUP_FIRST_ELEMENT (seen_store));
else
- {
- /* Free the attached stmt_vec_info and remove the
- stmt. */
- free_stmt_vec_info (stmt);
- unlink_stmt_vdef (stmt);
- gsi_remove (&si, true);
- release_defs (stmt);
- }
+ /* Free the attached stmt_vec_info and remove the stmt. */
+ loop_vinfo->remove_stmt (stmt_info);
}
- else
- gsi_next (&si);
}
}
slp_tree root = SLP_INSTANCE_TREE (instance);
stmt_vec_info store_info;
unsigned int j;
- gimple_stmt_iterator gsi;
/* Remove scalar call stmts. Do not do this for basic-block
vectorization as not all uses may be vectorized.
if (is_pattern_stmt_p (store_info))
store_info = STMT_VINFO_RELATED_STMT (store_info);
/* Free the attached stmt_vec_info and remove the stmt. */
- gsi = gsi_for_stmt (store_info);
- unlink_stmt_vdef (store_info);
- gsi_remove (&gsi, true);
- release_defs (store_info);
- free_stmt_vec_info (store_info);
+ vinfo->remove_stmt (store_info);
}
}
void
vect_remove_stores (stmt_vec_info first_stmt_info)
{
+ vec_info *vinfo = first_stmt_info->vinfo;
stmt_vec_info next_stmt_info = first_stmt_info;
- gimple_stmt_iterator next_si;
while (next_stmt_info)
{
if (is_pattern_stmt_p (next_stmt_info))
next_stmt_info = STMT_VINFO_RELATED_STMT (next_stmt_info);
/* Free the attached stmt_vec_info and remove the stmt. */
- next_si = gsi_for_stmt (next_stmt_info->stmt);
- unlink_stmt_vdef (next_stmt_info->stmt);
- gsi_remove (&next_si, true);
- release_defs (next_stmt_info->stmt);
- free_stmt_vec_info (next_stmt_info);
+ vinfo->remove_stmt (next_stmt_info);
next_stmt_info = tmp;
}
}
= STMT_VINFO_GATHER_SCATTER_P (old_stmt_info);
}
+/* Permanently remove the statement described by STMT_INFO from the
+ function. */
+
+void
+vec_info::remove_stmt (stmt_vec_info stmt_info)
+{
+ gcc_assert (!stmt_info->pattern_stmt_p);
+ gimple_stmt_iterator si = gsi_for_stmt (stmt_info->stmt);
+ unlink_stmt_vdef (stmt_info->stmt);
+ gsi_remove (&si, true);
+ release_defs (stmt_info->stmt);
+ free_stmt_vec_info (stmt_info);
+}
+
/* A helper function to free scev and LOOP niter information, as well as
clear loop constraint LOOP_C_FINITE. */
stmt_vec_info lookup_single_use (tree);
struct dr_vec_info *lookup_dr (data_reference *);
void move_dr (stmt_vec_info, stmt_vec_info);
+ void remove_stmt (stmt_vec_info);
/* The type of vectorization. */
vec_kind kind;