* tree-vect-slp.c (vect_free_slp_tree): Also free SLP_TREE_CHILDREN
vector.
(vect_create_new_slp_node): Don't allocate node before checking stmt
type.
(vect_free_oprnd_info): Remove FREE_DEF_STMTS argument, always
free def_stmts vectors and additionally free oprnd_info.
(vect_build_slp_tree): Adjust callers. Call it even if
stop_recursion. If vect_create_new_slp_node or
vect_build_slp_tree fails, properly handle freeing memory.
If it succeeded, clear def_stmts in oprnd_info.
From-SVN: r181281
+2011-11-11 Jakub Jelinek <jakub@redhat.com>
+
+ * tree-vect-slp.c (vect_free_slp_tree): Also free SLP_TREE_CHILDREN
+ vector.
+ (vect_create_new_slp_node): Don't allocate node before checking stmt
+ type.
+ (vect_free_oprnd_info): Remove FREE_DEF_STMTS argument, always
+ free def_stmts vectors and additionally free oprnd_info.
+ (vect_build_slp_tree): Adjust callers. Call it even if
+ stop_recursion. If vect_create_new_slp_node or
+ vect_build_slp_tree fails, properly handle freeing memory.
+ If it succeeded, clear def_stmts in oprnd_info.
+
2011-08-12 Dimitrios Apostolou <jimis@gmx.net>
* final.c, output.h (fprint_whex, fprint_w, fprint_ul, sprint_ul):
2011-08-12 Dimitrios Apostolou <jimis@gmx.net>
* final.c, output.h (fprint_whex, fprint_w, fprint_ul, sprint_ul):
return;
FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
return;
FOR_EACH_VEC_ELT (slp_void_p, SLP_TREE_CHILDREN (node), i, child)
- vect_free_slp_tree ((slp_tree)child);
+ vect_free_slp_tree ((slp_tree) child);
+ VEC_free (slp_void_p, heap, SLP_TREE_CHILDREN (node));
VEC_free (gimple, heap, SLP_TREE_SCALAR_STMTS (node));
if (SLP_TREE_VEC_STMTS (node))
VEC_free (gimple, heap, SLP_TREE_SCALAR_STMTS (node));
if (SLP_TREE_VEC_STMTS (node))
static slp_tree
vect_create_new_slp_node (VEC (gimple, heap) *scalar_stmts)
{
static slp_tree
vect_create_new_slp_node (VEC (gimple, heap) *scalar_stmts)
{
- slp_tree node = XNEW (struct _slp_tree);
gimple stmt = VEC_index (gimple, scalar_stmts, 0);
unsigned int nops;
gimple stmt = VEC_index (gimple, scalar_stmts, 0);
unsigned int nops;
+ node = XNEW (struct _slp_tree);
SLP_TREE_SCALAR_STMTS (node) = scalar_stmts;
SLP_TREE_VEC_STMTS (node) = NULL;
SLP_TREE_CHILDREN (node) = VEC_alloc (slp_void_p, heap, nops);
SLP_TREE_SCALAR_STMTS (node) = scalar_stmts;
SLP_TREE_VEC_STMTS (node) = NULL;
SLP_TREE_CHILDREN (node) = VEC_alloc (slp_void_p, heap, nops);
-/* Free operands info. Free def-stmts in FREE_DEF_STMTS is true.
- (FREE_DEF_STMTS is true when the SLP analysis fails, and false when it
- succeds. In the later case we don't need the operands info that we used to
- check isomorphism of the stmts, but we still need the def-stmts - they are
- used as scalar stmts in SLP nodes. */
+/* Free operands info. */
+
-vect_free_oprnd_info (VEC (slp_oprnd_info, heap) **oprnds_info,
- bool free_def_stmts)
+vect_free_oprnd_info (VEC (slp_oprnd_info, heap) **oprnds_info)
{
int i;
slp_oprnd_info oprnd_info;
{
int i;
slp_oprnd_info oprnd_info;
- if (free_def_stmts)
- FOR_EACH_VEC_ELT (slp_oprnd_info, *oprnds_info, i, oprnd_info)
+ FOR_EACH_VEC_ELT (slp_oprnd_info, *oprnds_info, i, oprnd_info)
+ {
VEC_free (gimple, heap, oprnd_info->def_stmts);
VEC_free (gimple, heap, oprnd_info->def_stmts);
+ XDELETE (oprnd_info);
+ }
VEC_free (slp_oprnd_info, heap, *oprnds_info);
}
VEC_free (slp_oprnd_info, heap, *oprnds_info);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
}
print_generic_expr (vect_dump, scalar_type, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
{
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: no optab.");
{
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: no optab.");
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
return false;
}
icode = (int) optab_handler (optab, vec_mode);
return false;
}
icode = (int) optab_handler (optab, vec_mode);
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: "
"op not supported by target.");
if (vect_print_dump_info (REPORT_SLP))
fprintf (vect_dump, "Build SLP failed: "
"op not supported by target.");
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
return false;
}
optab_op2_mode = insn_data[icode].operand[2].mode;
return false;
}
optab_op2_mode = insn_data[icode].operand[2].mode;
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
stmt, ncopies_for_cost,
(i == 0), &oprnds_info))
{
stmt, ncopies_for_cost,
(i == 0), &oprnds_info))
{
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
}
/* FORNOW: Not strided loads are not supported. */
}
/* FORNOW: Not strided loads are not supported. */
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
print_gimple_stmt (vect_dump, stmt, 0, TDF_SLIM);
}
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
ncopies_for_cost, (i == 0),
&oprnds_info))
{
ncopies_for_cost, (i == 0),
&oprnds_info))
{
- vect_free_oprnd_info (&oprnds_info, true);
+ vect_free_oprnd_info (&oprnds_info);
*loads_permuted = true;
}
*loads_permuted = true;
}
+ vect_free_oprnd_info (&oprnds_info);
max_nunits, load_permutation, loads,
vectorization_factor, loads_permuted))
{
max_nunits, load_permutation, loads,
vectorization_factor, loads_permuted))
{
- free (child);
- vect_free_oprnd_info (&oprnds_info, true);
+ if (child)
+ oprnd_info->def_stmts = NULL;
+ vect_free_slp_tree (child);
+ vect_free_oprnd_info (&oprnds_info);
+ oprnd_info->def_stmts = NULL;
VEC_quick_push (slp_void_p, SLP_TREE_CHILDREN (*node), child);
}
VEC_quick_push (slp_void_p, SLP_TREE_CHILDREN (*node), child);
}
- vect_free_oprnd_info (&oprnds_info, false);
+ vect_free_oprnd_info (&oprnds_info);