public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PR80803 1/2] Streamline SRA access enqueuing
@ 2017-06-12 17:08 Martin Jambor
  2017-06-13  7:11 ` Richard Biener
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2017-06-12 17:08 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Biener

Hi,

this is a preparation for a patch fixing PR 80803.  Basically, it
moves all checks for a non-null access->first_link before enqueuing a
SRA access into add_access_to_work_queue instead of each caller doing
it.

Moreover, it fixes a thinko in ancestor enqueuing by removing an
erroneous break which would previously stop the process at the first
access with a link.  This has been always wrong but is now more so
because with lazy grp_write setting, we rely proper enqueuing to
propagate it to all necessary accesses.

Bootstrapped on x86_64-linux (all languages including Ada and Go),
powerpc64le-linux (all languages except Ada but including Go) and
Aarch64-linux (the same).  OK for trunk?

Thanks,

Martin


2017-06-08  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (add_access_to_work_queue): Only enqueue accesses
	that have a first_link.
	(sort_and_splice_var_accesses): Do not check first_link before
	enquing.
	(subtree_mark_written_and_enqueue): Likewise.
	(propagate_all_subaccesses): Likewise and do not stop at first
	parent with a first_link.
---
 gcc/tree-sra.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
index 42879adbad1..05bc3d0e806 100644
--- a/gcc/tree-sra.c
+++ b/gcc/tree-sra.c
@@ -627,7 +627,7 @@ relink_to_new_repr (struct access *new_racc, struct access *old_racc)
 static void
 add_access_to_work_queue (struct access *access)
 {
-  if (!access->grp_queued)
+  if (access->first_link && !access->grp_queued)
     {
       gcc_assert (!access->next_queued);
       access->next_queued = work_queue_head;
@@ -2112,8 +2112,7 @@ sort_and_splice_var_accesses (tree var)
       access->grp_total_scalarization = total_scalarization;
       access->grp_partial_lhs = grp_partial_lhs;
       access->grp_unscalarizable_region = unscalarizable_region;
-      if (access->first_link)
-	add_access_to_work_queue (access);
+      add_access_to_work_queue (access);
 
       *prev_acc_ptr = access;
       prev_acc_ptr = &access->next_grp;
@@ -2670,8 +2669,7 @@ subtree_mark_written_and_enqueue (struct access *access)
   if (access->grp_write)
     return;
   access->grp_write = true;
-  if (access->first_link)
-    add_access_to_work_queue (access);
+  add_access_to_work_queue (access);
 
   struct access *child;
   for (child = access->first_child; child; child = child->next_sibling)
@@ -2715,11 +2713,7 @@ propagate_all_subaccesses (void)
 	  if (reque_parents)
 	    do
 	      {
-		if (lacc->first_link)
-		  {
-		    add_access_to_work_queue (lacc);
-		    break;
-		  }
+		add_access_to_work_queue (lacc);
 		lacc = lacc->parent;
 	      }
 	    while (lacc);
-- 
2.13.1

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PR80803 1/2] Streamline SRA access enqueuing
  2017-06-12 17:08 [PR80803 1/2] Streamline SRA access enqueuing Martin Jambor
@ 2017-06-13  7:11 ` Richard Biener
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2017-06-13  7:11 UTC (permalink / raw)
  To: Martin Jambor; +Cc: GCC Patches

On Mon, 12 Jun 2017, Martin Jambor wrote:

> Hi,
> 
> this is a preparation for a patch fixing PR 80803.  Basically, it
> moves all checks for a non-null access->first_link before enqueuing a
> SRA access into add_access_to_work_queue instead of each caller doing
> it.
> 
> Moreover, it fixes a thinko in ancestor enqueuing by removing an
> erroneous break which would previously stop the process at the first
> access with a link.  This has been always wrong but is now more so
> because with lazy grp_write setting, we rely proper enqueuing to
> propagate it to all necessary accesses.
> 
> Bootstrapped on x86_64-linux (all languages including Ada and Go),
> powerpc64le-linux (all languages except Ada but including Go) and
> Aarch64-linux (the same).  OK for trunk?

Ok.

Richard.

> Thanks,
> 
> Martin
> 
> 
> 2017-06-08  Martin Jambor  <mjambor@suse.cz>
> 
> 	* tree-sra.c (add_access_to_work_queue): Only enqueue accesses
> 	that have a first_link.
> 	(sort_and_splice_var_accesses): Do not check first_link before
> 	enquing.
> 	(subtree_mark_written_and_enqueue): Likewise.
> 	(propagate_all_subaccesses): Likewise and do not stop at first
> 	parent with a first_link.
> ---
>  gcc/tree-sra.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c
> index 42879adbad1..05bc3d0e806 100644
> --- a/gcc/tree-sra.c
> +++ b/gcc/tree-sra.c
> @@ -627,7 +627,7 @@ relink_to_new_repr (struct access *new_racc, struct access *old_racc)
>  static void
>  add_access_to_work_queue (struct access *access)
>  {
> -  if (!access->grp_queued)
> +  if (access->first_link && !access->grp_queued)
>      {
>        gcc_assert (!access->next_queued);
>        access->next_queued = work_queue_head;
> @@ -2112,8 +2112,7 @@ sort_and_splice_var_accesses (tree var)
>        access->grp_total_scalarization = total_scalarization;
>        access->grp_partial_lhs = grp_partial_lhs;
>        access->grp_unscalarizable_region = unscalarizable_region;
> -      if (access->first_link)
> -	add_access_to_work_queue (access);
> +      add_access_to_work_queue (access);
>  
>        *prev_acc_ptr = access;
>        prev_acc_ptr = &access->next_grp;
> @@ -2670,8 +2669,7 @@ subtree_mark_written_and_enqueue (struct access *access)
>    if (access->grp_write)
>      return;
>    access->grp_write = true;
> -  if (access->first_link)
> -    add_access_to_work_queue (access);
> +  add_access_to_work_queue (access);
>  
>    struct access *child;
>    for (child = access->first_child; child; child = child->next_sibling)
> @@ -2715,11 +2713,7 @@ propagate_all_subaccesses (void)
>  	  if (reque_parents)
>  	    do
>  	      {
> -		if (lacc->first_link)
> -		  {
> -		    add_access_to_work_queue (lacc);
> -		    break;
> -		  }
> +		add_access_to_work_queue (lacc);
>  		lacc = lacc->parent;
>  	      }
>  	    while (lacc);
> 

-- 
Richard Biener <rguenther@suse.de>
SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nuernberg)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-06-13  7:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-12 17:08 [PR80803 1/2] Streamline SRA access enqueuing Martin Jambor
2017-06-13  7:11 ` 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).