public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Better propagation of flags in access trees of SRA
@ 2011-06-07 16:24 Martin Jambor
  2011-06-08  8:31 ` Richard Guenther
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Jambor @ 2011-06-07 16:24 UTC (permalink / raw)
  To: GCC Patches; +Cc: Richard Guenther

Hi,

the way we propagate flags in SRA access tree has evolved in an
unfortunate way, this patch simplifies the whole thing while doing
exactly the same thing.

Bootstrapped and tested on x86_64-linux, OK for trunk?

Thanks,

Martin



2011-06-06  Martin Jambor  <mjambor@suse.cz>

	* tree-sra.c (mark_rw_status): Removed.
	(analyze_access_subtree): New parameter parent instead of
	mark_read and mark_write, propagate from that.

Index: src/gcc/tree-sra.c
===================================================================
*** src.orig/gcc/tree-sra.c
--- src/gcc/tree-sra.c
*************** expr_with_var_bounded_array_refs_p (tree
*** 1864,1871 ****
    return false;
  }
  
- enum mark_rw_status { SRA_MRRW_NOTHING, SRA_MRRW_DIRECT, SRA_MRRW_ASSIGN};
- 
  /* Analyze the subtree of accesses rooted in ROOT, scheduling replacements when
     both seeming beneficial and when ALLOW_REPLACEMENTS allows it.  Also set all
     sorts of access flags appropriately along the way, notably always set
--- 1864,1869 ----
*************** enum mark_rw_status { SRA_MRRW_NOTHING,
*** 1905,1913 ****
     1	1	1	1	Yes		Any of the above yeses  */
  
  static bool
! analyze_access_subtree (struct access *root, bool allow_replacements,
! 			enum mark_rw_status mark_read,
! 			enum mark_rw_status mark_write)
  {
    struct access *child;
    HOST_WIDE_INT limit = root->offset + root->size;
--- 1903,1910 ----
     1	1	1	1	Yes		Any of the above yeses  */
  
  static bool
! analyze_access_subtree (struct access *root, struct access *parent,
! 			bool allow_replacements)
  {
    struct access *child;
    HOST_WIDE_INT limit = root->offset + root->size;
*************** analyze_access_subtree (struct access *r
*** 1915,1943 ****
    bool scalar = is_gimple_reg_type (root->type);
    bool hole = false, sth_created = false;
  
!   if (root->grp_assignment_read)
!     mark_read = SRA_MRRW_ASSIGN;
!   else if (mark_read == SRA_MRRW_ASSIGN)
!     {
!       root->grp_read = 1;
!       root->grp_assignment_read = 1;
!     }
!   else if (mark_read == SRA_MRRW_DIRECT)
!     root->grp_read = 1;
!   else if (root->grp_read)
!     mark_read = SRA_MRRW_DIRECT;
! 
!   if (root->grp_assignment_write)
!     mark_write = SRA_MRRW_ASSIGN;
!   else if (mark_write == SRA_MRRW_ASSIGN)
      {
!       root->grp_write = 1;
!       root->grp_assignment_write = 1;
      }
-   else if (mark_write == SRA_MRRW_DIRECT)
-     root->grp_write = 1;
-   else if (root->grp_write)
-     mark_write = SRA_MRRW_DIRECT;
  
    if (root->grp_unscalarizable_region)
      allow_replacements = false;
--- 1912,1928 ----
    bool scalar = is_gimple_reg_type (root->type);
    bool hole = false, sth_created = false;
  
!   if (parent)
      {
!       if (parent->grp_read)
! 	root->grp_read = 1;
!       if (parent->grp_assignment_read)
! 	root->grp_assignment_read = 1;
!       if (parent->grp_write)
! 	root->grp_write = 1;
!       if (parent->grp_assignment_write)
! 	root->grp_assignment_write = 1;
      }
  
    if (root->grp_unscalarizable_region)
      allow_replacements = false;
*************** analyze_access_subtree (struct access *r
*** 1952,1960 ****
        else
  	covered_to += child->size;
  
!       sth_created |= analyze_access_subtree (child,
! 					     allow_replacements && !scalar,
! 					     mark_read, mark_write);
  
        root->grp_unscalarized_data |= child->grp_unscalarized_data;
        hole |= !child->grp_covered;
--- 1937,1944 ----
        else
  	covered_to += child->size;
  
!       sth_created |= analyze_access_subtree (child, root,
! 					     allow_replacements && !scalar);
  
        root->grp_unscalarized_data |= child->grp_unscalarized_data;
        hole |= !child->grp_covered;
*************** analyze_access_trees (struct access *acc
*** 2002,2009 ****
  
    while (access)
      {
!       if (analyze_access_subtree (access, true,
! 				  SRA_MRRW_NOTHING, SRA_MRRW_NOTHING))
  	ret = true;
        access = access->next_grp;
      }
--- 1986,1992 ----
  
    while (access)
      {
!       if (analyze_access_subtree (access, NULL, true))
  	ret = true;
        access = access->next_grp;
      }

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

* Re: [PATCH] Better propagation of flags in access trees of SRA
  2011-06-07 16:24 [PATCH] Better propagation of flags in access trees of SRA Martin Jambor
@ 2011-06-08  8:31 ` Richard Guenther
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Guenther @ 2011-06-08  8:31 UTC (permalink / raw)
  To: Martin Jambor; +Cc: GCC Patches

[-- Attachment #1: Type: TEXT/PLAIN, Size: 4647 bytes --]

On Tue, 7 Jun 2011, Martin Jambor wrote:

> Hi,
> 
> the way we propagate flags in SRA access tree has evolved in an
> unfortunate way, this patch simplifies the whole thing while doing
> exactly the same thing.
> 
> Bootstrapped and tested on x86_64-linux, OK for trunk?

Ok.

Thanks,
Richard.

> Thanks,
> 
> Martin
> 
> 
> 
> 2011-06-06  Martin Jambor  <mjambor@suse.cz>
> 
> 	* tree-sra.c (mark_rw_status): Removed.
> 	(analyze_access_subtree): New parameter parent instead of
> 	mark_read and mark_write, propagate from that.
> 
> Index: src/gcc/tree-sra.c
> ===================================================================
> *** src.orig/gcc/tree-sra.c
> --- src/gcc/tree-sra.c
> *************** expr_with_var_bounded_array_refs_p (tree
> *** 1864,1871 ****
>     return false;
>   }
>   
> - enum mark_rw_status { SRA_MRRW_NOTHING, SRA_MRRW_DIRECT, SRA_MRRW_ASSIGN};
> - 
>   /* Analyze the subtree of accesses rooted in ROOT, scheduling replacements when
>      both seeming beneficial and when ALLOW_REPLACEMENTS allows it.  Also set all
>      sorts of access flags appropriately along the way, notably always set
> --- 1864,1869 ----
> *************** enum mark_rw_status { SRA_MRRW_NOTHING,
> *** 1905,1913 ****
>      1	1	1	1	Yes		Any of the above yeses  */
>   
>   static bool
> ! analyze_access_subtree (struct access *root, bool allow_replacements,
> ! 			enum mark_rw_status mark_read,
> ! 			enum mark_rw_status mark_write)
>   {
>     struct access *child;
>     HOST_WIDE_INT limit = root->offset + root->size;
> --- 1903,1910 ----
>      1	1	1	1	Yes		Any of the above yeses  */
>   
>   static bool
> ! analyze_access_subtree (struct access *root, struct access *parent,
> ! 			bool allow_replacements)
>   {
>     struct access *child;
>     HOST_WIDE_INT limit = root->offset + root->size;
> *************** analyze_access_subtree (struct access *r
> *** 1915,1943 ****
>     bool scalar = is_gimple_reg_type (root->type);
>     bool hole = false, sth_created = false;
>   
> !   if (root->grp_assignment_read)
> !     mark_read = SRA_MRRW_ASSIGN;
> !   else if (mark_read == SRA_MRRW_ASSIGN)
> !     {
> !       root->grp_read = 1;
> !       root->grp_assignment_read = 1;
> !     }
> !   else if (mark_read == SRA_MRRW_DIRECT)
> !     root->grp_read = 1;
> !   else if (root->grp_read)
> !     mark_read = SRA_MRRW_DIRECT;
> ! 
> !   if (root->grp_assignment_write)
> !     mark_write = SRA_MRRW_ASSIGN;
> !   else if (mark_write == SRA_MRRW_ASSIGN)
>       {
> !       root->grp_write = 1;
> !       root->grp_assignment_write = 1;
>       }
> -   else if (mark_write == SRA_MRRW_DIRECT)
> -     root->grp_write = 1;
> -   else if (root->grp_write)
> -     mark_write = SRA_MRRW_DIRECT;
>   
>     if (root->grp_unscalarizable_region)
>       allow_replacements = false;
> --- 1912,1928 ----
>     bool scalar = is_gimple_reg_type (root->type);
>     bool hole = false, sth_created = false;
>   
> !   if (parent)
>       {
> !       if (parent->grp_read)
> ! 	root->grp_read = 1;
> !       if (parent->grp_assignment_read)
> ! 	root->grp_assignment_read = 1;
> !       if (parent->grp_write)
> ! 	root->grp_write = 1;
> !       if (parent->grp_assignment_write)
> ! 	root->grp_assignment_write = 1;
>       }
>   
>     if (root->grp_unscalarizable_region)
>       allow_replacements = false;
> *************** analyze_access_subtree (struct access *r
> *** 1952,1960 ****
>         else
>   	covered_to += child->size;
>   
> !       sth_created |= analyze_access_subtree (child,
> ! 					     allow_replacements && !scalar,
> ! 					     mark_read, mark_write);
>   
>         root->grp_unscalarized_data |= child->grp_unscalarized_data;
>         hole |= !child->grp_covered;
> --- 1937,1944 ----
>         else
>   	covered_to += child->size;
>   
> !       sth_created |= analyze_access_subtree (child, root,
> ! 					     allow_replacements && !scalar);
>   
>         root->grp_unscalarized_data |= child->grp_unscalarized_data;
>         hole |= !child->grp_covered;
> *************** analyze_access_trees (struct access *acc
> *** 2002,2009 ****
>   
>     while (access)
>       {
> !       if (analyze_access_subtree (access, true,
> ! 				  SRA_MRRW_NOTHING, SRA_MRRW_NOTHING))
>   	ret = true;
>         access = access->next_grp;
>       }
> --- 1986,1992 ----
>   
>     while (access)
>       {
> !       if (analyze_access_subtree (access, NULL, true))
>   	ret = true;
>         access = access->next_grp;
>       }
> 
> 

-- 
Richard Guenther <rguenther@suse.de>
Novell / SUSE Labs
SUSE LINUX Products GmbH - Nuernberg - AG Nuernberg - HRB 16746
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer

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

end of thread, other threads:[~2011-06-08  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-07 16:24 [PATCH] Better propagation of flags in access trees of SRA Martin Jambor
2011-06-08  8:31 ` Richard Guenther

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).