* [PATCH v2 1/16]middle-end: Refactor refcnt to use SLP_TREE_REF_COUNT for consistency
@ 2020-09-25 14:27 Tamar Christina
2020-09-28 11:56 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Tamar Christina @ 2020-09-25 14:27 UTC (permalink / raw)
To: gcc-patches; +Cc: nd, rguenther, ook
[-- Attachment #1: Type: text/plain, Size: 634 bytes --]
Hi All,
This is a small refactoring which introduces SLP_TREE_REF_COUNT and replaces
the uses of refcnt with it. This for consistency between the other properties.
A similar patch was pre-approved last year but since there are more use now I am
sending it for review anyway.
Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
Ok for master?
Thanks,
Tamar
gcc/ChangeLog:
* tree-vectorizer.h (SLP_TREE_REF_COUNT): New.
* tree-vect-slp.c (_slp_tree::_slp_tree, _slp_tree::~_slp_tree,
vect_free_slp_tree, vect_build_slp_tree, vect_print_slp_tree,
slp_copy_subtree, vect_attempt_slp_rearrange_stmts): Use it.
--
[-- Attachment #2: rb13505.patch --]
[-- Type: text/x-diff, Size: 4138 bytes --]
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index c44fd396bf0b69a4153e46026c545bebb3797551..bf8ea4326597f4211d2772e9db60aa69285b5998 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -66,7 +66,7 @@ _slp_tree::_slp_tree ()
SLP_TREE_CODE (this) = ERROR_MARK;
SLP_TREE_VECTYPE (this) = NULL_TREE;
SLP_TREE_REPRESENTATIVE (this) = NULL;
- this->refcnt = 1;
+ SLP_TREE_REF_COUNT (this) = 1;
this->max_nunits = 1;
this->lanes = 0;
}
@@ -92,7 +92,7 @@ vect_free_slp_tree (slp_tree node)
int i;
slp_tree child;
- if (--node->refcnt != 0)
+ if (--SLP_TREE_REF_COUNT (node) != 0)
return;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (node), i, child)
@@ -1180,7 +1180,7 @@ vect_build_slp_tree (vec_info *vinfo,
*leader ? "" : "failed ", *leader);
if (*leader)
{
- (*leader)->refcnt++;
+ SLP_TREE_REF_COUNT (*leader)++;
vect_update_max_nunits (max_nunits, (*leader)->max_nunits);
}
return *leader;
@@ -1194,7 +1194,7 @@ vect_build_slp_tree (vec_info *vinfo,
res->max_nunits = this_max_nunits;
vect_update_max_nunits (max_nunits, this_max_nunits);
/* Keep a reference for the bst_map use. */
- res->refcnt++;
+ SLP_TREE_REF_COUNT (res)++;
}
bst_map->put (stmts.copy (), res);
return res;
@@ -1590,7 +1590,7 @@ fail:
SLP_TREE_CHILDREN (two).safe_splice (children);
slp_tree child;
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (two), i, child)
- child->refcnt++;
+ SLP_TREE_REF_COUNT (child)++;
/* Here we record the original defs since this
node represents the final lane configuration. */
@@ -1650,7 +1650,8 @@ vect_print_slp_tree (dump_flags_t dump_kind, dump_location_t loc,
: (SLP_TREE_DEF_TYPE (node) == vect_constant_def
? " (constant)"
: ""), node,
- estimated_poly_value (node->max_nunits), node->refcnt);
+ estimated_poly_value (node->max_nunits),
+ SLP_TREE_REF_COUNT (node));
if (SLP_TREE_SCALAR_STMTS (node).exists ())
FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, stmt_info)
dump_printf_loc (metadata, user_loc, "\tstmt %u %G", i, stmt_info->stmt);
@@ -1802,7 +1803,7 @@ slp_copy_subtree (slp_tree node, hash_map<slp_tree, slp_tree> &map)
SLP_TREE_REPRESENTATIVE (copy) = SLP_TREE_REPRESENTATIVE (node);
SLP_TREE_LANES (copy) = SLP_TREE_LANES (node);
copy->max_nunits = node->max_nunits;
- copy->refcnt = 0;
+ SLP_TREE_REF_COUNT (copy) = 0;
if (SLP_TREE_SCALAR_STMTS (node).exists ())
SLP_TREE_SCALAR_STMTS (copy) = SLP_TREE_SCALAR_STMTS (node).copy ();
if (SLP_TREE_SCALAR_OPS (node).exists ())
@@ -1819,7 +1820,7 @@ slp_copy_subtree (slp_tree node, hash_map<slp_tree, slp_tree> &map)
FOR_EACH_VEC_ELT (SLP_TREE_CHILDREN (copy), i, child)
{
SLP_TREE_CHILDREN (copy)[i] = slp_copy_subtree (child, map);
- SLP_TREE_CHILDREN (copy)[i]->refcnt++;
+ SLP_TREE_REF_COUNT (SLP_TREE_CHILDREN (copy)[i])++;
}
return copy;
}
@@ -1935,7 +1936,7 @@ vect_attempt_slp_rearrange_stmts (slp_instance slp_instn)
hash_map<slp_tree, slp_tree> map;
slp_tree unshared = slp_copy_subtree (SLP_INSTANCE_TREE (slp_instn), map);
vect_free_slp_tree (SLP_INSTANCE_TREE (slp_instn));
- unshared->refcnt++;
+ SLP_TREE_REF_COUNT (unshared)++;
SLP_INSTANCE_TREE (slp_instn) = unshared;
FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (slp_instn), i, node)
SLP_INSTANCE_LOADS (slp_instn)[i] = *map.get (node);
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index 9dffc5570e51b21c2f5c02b80a9f49d25a183284..2ebcf9f9926ec7175f28391f172800499bbc59db 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -204,6 +204,7 @@ public:
#define SLP_TREE_CHILDREN(S) (S)->children
#define SLP_TREE_SCALAR_STMTS(S) (S)->stmts
#define SLP_TREE_SCALAR_OPS(S) (S)->ops
+#define SLP_TREE_REF_COUNT(S) (S)->refcnt
#define SLP_TREE_VEC_STMTS(S) (S)->vec_stmts
#define SLP_TREE_VEC_DEFS(S) (S)->vec_defs
#define SLP_TREE_NUMBER_OF_VEC_STMTS(S) (S)->vec_stmts_size
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2 1/16]middle-end: Refactor refcnt to use SLP_TREE_REF_COUNT for consistency
2020-09-25 14:27 [PATCH v2 1/16]middle-end: Refactor refcnt to use SLP_TREE_REF_COUNT for consistency Tamar Christina
@ 2020-09-28 11:56 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2020-09-28 11:56 UTC (permalink / raw)
To: Tamar Christina; +Cc: gcc-patches, nd, ook
On Fri, 25 Sep 2020, Tamar Christina wrote:
> Hi All,
>
> This is a small refactoring which introduces SLP_TREE_REF_COUNT and replaces
> the uses of refcnt with it. This for consistency between the other properties.
>
> A similar patch was pre-approved last year but since there are more use now I am
> sending it for review anyway.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>
> Ok for master?
OK.
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> * tree-vectorizer.h (SLP_TREE_REF_COUNT): New.
> * tree-vect-slp.c (_slp_tree::_slp_tree, _slp_tree::~_slp_tree,
> vect_free_slp_tree, vect_build_slp_tree, vect_print_slp_tree,
> slp_copy_subtree, vect_attempt_slp_rearrange_stmts): Use it.
>
>
--
Richard Biener <rguenther@suse.de>
SUSE Software Solutions Germany GmbH, Maxfeldstrasse 5, 90409 Nuernberg,
Germany; GF: Felix Imend
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-28 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-25 14:27 [PATCH v2 1/16]middle-end: Refactor refcnt to use SLP_TREE_REF_COUNT for consistency Tamar Christina
2020-09-28 11:56 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).