tree-vectorizer.c (free_stmt_vec_info): New function.

2008-03-12  Victor Kaplansky  <victork@il.ibm.com>
            Ira Rosen  <irar@il.ibm.com>

        * tree-vectorizer.c (free_stmt_vec_info): New function.
        (destroy_loop_vec_info): Move code to free_stmt_vec_info().
        Call free_stmt_vec_info(). Free LOOP_VINFO_STRIDED_STORES..
        * tree-vectorizer.h (free_stmt_vec_info): Declare.
        * tree-vect-transform.c (vectorizable_conversion): Free
        vec_oprnds0 if it was allocated.
        (vect_permute_store_chain): Remove unused VECs.
        (vectorizable_store): Free VECs that are allocated in the..
        function.
        (vect_transform_strided_load, vectorizable_load): Likewise.
        (vect_remove_stores): Simplify the code.
        (vect_transform_loop): Move code to vect_remove_stores().
        Call vect_remove_stores() and free_stmt_vec_info().


Co-Authored-By: Ira Rosen <irar@il.ibm.com>

From-SVN: r133134
This commit is contained in:
Victor Kaplansky 2008-03-12 06:06:00 +00:00 committed by Victor Kaplansky
parent dedba68244
commit 628781031e
4 changed files with 56 additions and 43 deletions

View File

@ -1,3 +1,20 @@
2008-03-12 Victor Kaplansky <victork@il.ibm.com>
Ira Rosen <irar@il.ibm.com>
* tree-vectorizer.c (free_stmt_vec_info): New function.
(destroy_loop_vec_info): Move code to free_stmt_vec_info().
Call free_stmt_vec_info(). Free LOOP_VINFO_STRIDED_STORES..
* tree-vectorizer.h (free_stmt_vec_info): Declare.
* tree-vect-transform.c (vectorizable_conversion): Free
vec_oprnds0 if it was allocated.
(vect_permute_store_chain): Remove unused VECs.
(vectorizable_store): Free VECs that are allocated in the..
function.
(vect_transform_strided_load, vectorizable_load): Likewise.
(vect_remove_stores): Simplify the code.
(vect_transform_loop): Move code to vect_remove_stores().
Call vect_remove_stores() and free_stmt_vec_info().
2008-03-11 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
* pa.h (TARGET_LONG_PIC_SDIFF_CALL): Conditionalize define on

View File

@ -3631,6 +3631,9 @@ vectorizable_conversion (tree stmt, block_stmt_iterator *bsi,
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
}
if (vec_oprnds0)
VEC_free (tree, heap, vec_oprnds0);
return true;
}
@ -4582,11 +4585,8 @@ vect_permute_store_chain (VEC(tree,heap) *dr_chain,
tree scalar_dest, tmp;
int i;
unsigned int j;
VEC(tree,heap) *first, *second;
scalar_dest = GIMPLE_STMT_OPERAND (stmt, 0);
first = VEC_alloc (tree, heap, length/2);
second = VEC_alloc (tree, heap, length/2);
/* Check that the operation is supported. */
if (!vect_strided_store_supported (vectype))
@ -4969,6 +4969,11 @@ vectorizable_store (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
}
}
VEC_free (tree, heap, dr_chain);
VEC_free (tree, heap, oprnds);
if (result_chain)
VEC_free (tree, heap, result_chain);
return true;
}
@ -5474,6 +5479,8 @@ vect_transform_strided_load (tree stmt, VEC(tree,heap) *dr_chain, int size,
break;
}
}
VEC_free (tree, heap, result_chain);
return true;
}
@ -5911,6 +5918,7 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
if (!vect_transform_strided_load (stmt, dr_chain, group_size, bsi))
return false;
*vec_stmt = STMT_VINFO_VEC_STMT (stmt_info);
VEC_free (tree, heap, dr_chain);
dr_chain = VEC_alloc (tree, heap, group_size);
}
else
@ -5923,6 +5931,9 @@ vectorizable_load (tree stmt, block_stmt_iterator *bsi, tree *vec_stmt,
}
}
if (dr_chain)
VEC_free (tree, heap, dr_chain);
return true;
}
@ -7259,10 +7270,8 @@ vect_loop_versioning (loop_vec_info loop_vinfo)
static void
vect_remove_stores (tree first_stmt)
{
stmt_ann_t ann;
tree next = first_stmt;
tree tmp;
stmt_vec_info next_stmt_info;
block_stmt_iterator next_si;
while (next)
@ -7270,11 +7279,8 @@ vect_remove_stores (tree first_stmt)
/* Free the attached stmt_vec_info and remove the stmt. */
next_si = bsi_for_stmt (next);
bsi_remove (&next_si, true);
next_stmt_info = vinfo_for_stmt (next);
ann = stmt_ann (next);
tmp = DR_GROUP_NEXT_DR (next_stmt_info);
free (next_stmt_info);
set_stmt_info (ann, NULL);
tmp = DR_GROUP_NEXT_DR (vinfo_for_stmt (next));
free_stmt_vec_info (next);
next = tmp;
}
}
@ -7373,7 +7379,7 @@ vect_transform_loop (loop_vec_info loop_vinfo)
struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo);
basic_block *bbs = LOOP_VINFO_BBS (loop_vinfo);
int nbbs = loop->num_nodes;
block_stmt_iterator si, next_si;
block_stmt_iterator si;
int i;
tree ratio = NULL;
int vectorization_factor = LOOP_VINFO_VECT_FACTOR (loop_vinfo);
@ -7538,37 +7544,19 @@ vect_transform_loop (loop_vec_info loop_vinfo)
is_store = vect_transform_stmt (stmt, &si, &strided_store, NULL);
if (is_store)
{
stmt_ann_t ann;
if (STMT_VINFO_STRIDED_ACCESS (stmt_info))
{
/* Interleaving. If IS_STORE is TRUE, the vectorization of the
interleaving chain was completed - free all the stores in
the chain. */
tree next = DR_GROUP_FIRST_DR (stmt_info);
tree tmp;
stmt_vec_info next_stmt_info;
while (next)
{
next_si = bsi_for_stmt (next);
next_stmt_info = vinfo_for_stmt (next);
/* Free the attached stmt_vec_info and remove the stmt. */
ann = stmt_ann (next);
tmp = DR_GROUP_NEXT_DR (next_stmt_info);
free (next_stmt_info);
set_stmt_info (ann, NULL);
bsi_remove (&next_si, true);
next = tmp;
}
vect_remove_stores (DR_GROUP_FIRST_DR (stmt_info));
bsi_remove (&si, true);
continue;
}
else
{
/* Free the attached stmt_vec_info and remove the stmt. */
ann = stmt_ann (stmt);
free (stmt_info);
set_stmt_info (ann, NULL);
free_stmt_vec_info (stmt);
bsi_remove (&si, true);
continue;
}

View File

@ -1545,6 +1545,22 @@ new_stmt_vec_info (tree stmt, loop_vec_info loop_vinfo)
}
/* Free stmt vectorization related info. */
void
free_stmt_vec_info (tree stmt)
{
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
if (!stmt_info)
return;
VEC_free (dr_p, heap, STMT_VINFO_SAME_ALIGN_REFS (stmt_info));
free (stmt_info);
set_stmt_info (stmt_ann (stmt), NULL);
}
/* Function bb_in_loop_p
Used as predicate for dfs order traversal of the loop bbs. */
@ -1701,21 +1717,13 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
{
basic_block bb = bbs[j];
tree phi;
stmt_vec_info stmt_info;
for (phi = phi_nodes (bb); phi; phi = PHI_CHAIN (phi))
{
stmt_ann_t ann = stmt_ann (phi);
stmt_info = vinfo_for_stmt (phi);
free (stmt_info);
set_stmt_info (ann, NULL);
}
free_stmt_vec_info (phi);
for (si = bsi_start (bb); !bsi_end_p (si); )
{
tree stmt = bsi_stmt (si);
stmt_ann_t ann = stmt_ann (stmt);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
if (stmt_info)
@ -1733,9 +1741,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
}
/* Free stmt_vec_info. */
VEC_free (dr_p, heap, STMT_VINFO_SAME_ALIGN_REFS (stmt_info));
free (stmt_info);
set_stmt_info (ann, NULL);
free_stmt_vec_info (stmt);
/* Remove dead "pattern stmts". */
if (remove_stmt_p)
@ -1754,6 +1760,7 @@ destroy_loop_vec_info (loop_vec_info loop_vinfo, bool clean_stmts)
for (j = 0; VEC_iterate (slp_instance, slp_instances, j, instance); j++)
vect_free_slp_tree (SLP_INSTANCE_TREE (instance));
VEC_free (slp_instance, heap, LOOP_VINFO_SLP_INSTANCES (loop_vinfo));
VEC_free (tree, heap, LOOP_VINFO_STRIDED_STORES (loop_vinfo));
free (loop_vinfo);
loop->aux = NULL;

View File

@ -660,6 +660,7 @@ extern bool supportable_narrowing_operation (enum tree_code, const_tree,
extern loop_vec_info new_loop_vec_info (struct loop *loop);
extern void destroy_loop_vec_info (loop_vec_info, bool);
extern stmt_vec_info new_stmt_vec_info (tree stmt, loop_vec_info);
extern void free_stmt_vec_info (tree stmt);
/** In tree-vect-analyze.c **/