diff options
author | Richard Biener <rguenther@suse.de> | 2024-08-28 11:04:07 +0200 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2024-08-28 12:44:46 +0200 |
commit | 04065d8c3083f76f877dc62d56807a7d3638be69 (patch) | |
tree | d6feae62b574ddac89d784f4213f38f9099d527a /gcc | |
parent | ad895a28905c143ec731741cc93ebb340f59bfa8 (diff) | |
download | gcc-04065d8c3083f76f877dc62d56807a7d3638be69.zip gcc-04065d8c3083f76f877dc62d56807a7d3638be69.tar.gz gcc-04065d8c3083f76f877dc62d56807a7d3638be69.tar.bz2 |
Fix leak of SLP nodes when building store interleaving
The following fixes a leak of the discovered single-lane store
SLP nodes from which we only use their children. This uncovers
a latent reference counting issue in the interleaving build where
we fail to increment their reference count.
* tree-vect-slp.cc (vect_build_slp_store_interleaving):
Fix reference counting.
(vect_build_slp_instance): Release rhs_nodes.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree-vect-slp.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 79d83ef..d110c99 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -3486,6 +3486,7 @@ vect_build_slp_store_interleaving (vec<slp_tree> &rhs_nodes, { SLP_TREE_CHILDREN (perm) .quick_push (SLP_TREE_CHILDREN (rhs_nodes[j])[l]); + SLP_TREE_CHILDREN (rhs_nodes[j])[l]->refcnt++; for (unsigned k = 0; k < SLP_TREE_SCALAR_STMTS (rhs_nodes[j]).length (); ++k) { @@ -3949,6 +3950,9 @@ vect_build_slp_instance (vec_info *vinfo, /* Now we assume we can build the root SLP node from all stores. */ node = vect_build_slp_store_interleaving (rhs_nodes, scalar_stmts); + while (!rhs_nodes.is_empty ()) + vect_free_slp_tree (rhs_nodes.pop ()); + /* Create a new SLP instance. */ slp_instance new_instance = XNEW (class _slp_instance); SLP_INSTANCE_TREE (new_instance) = node; |