Patchwork No SRA debug replacements for variables that cannot be removed

login
register
mail settings
Submitter Martin Jambor
Date Jan. 15, 2013, 3:52 p.m.
Message ID <20130115155216.GA22390@virgil.suse>
Download mbox | patch
Permalink /patch/212213/
State New
Headers show

Comments

Martin Jambor - Jan. 15, 2013, 3:52 p.m.
Hi,

as discussed in PR 55920, this patch prevents SRA from creating debug
replacements and debug statements for aggregate variables which cannot
be scalarized away.  Jakub bootstrapped and tested the patch and I
suppose he is OK with it too so I will commit is shortly.

Thanks,

Martin


2013-01-11  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimization/55920
	* tree-sra.c (analyze_access_subtree): Do not mark non-removable
	accesses as grp_to_be_debug_replaced.
Jakub Jelinek - Jan. 15, 2013, 4:05 p.m.
On Tue, Jan 15, 2013 at 04:52:16PM +0100, Martin Jambor wrote:
> 2013-01-11  Martin Jambor  <mjambor@suse.cz>
> 
> 	PR tree-optimization/55920
> 	* tree-sra.c (analyze_access_subtree): Do not mark non-removable
> 	accesses as grp_to_be_debug_replaced.

Ok, thanks.

> --- src.orig/gcc/tree-sra.c
> +++ src/gcc/tree-sra.c
> @@ -2199,7 +2199,9 @@ analyze_access_subtree (struct access *r
>      {
>        if (allow_replacements
>  	  && scalar && !root->first_child
> -	  && (root->grp_scalar_write || root->grp_assignment_write))
> +	  && (root->grp_scalar_write || root->grp_assignment_write)
> +	  && !bitmap_bit_p (cannot_scalarize_away_bitmap,
> +			    DECL_UID (root->base)))
>  	{
>  	  gcc_checking_assert (!root->grp_scalar_read
>  			       && !root->grp_assignment_read);

	Jakub

Patch

Index: src/gcc/tree-sra.c
===================================================================
--- src.orig/gcc/tree-sra.c
+++ src/gcc/tree-sra.c
@@ -2199,7 +2199,9 @@  analyze_access_subtree (struct access *r
     {
       if (allow_replacements
 	  && scalar && !root->first_child
-	  && (root->grp_scalar_write || root->grp_assignment_write))
+	  && (root->grp_scalar_write || root->grp_assignment_write)
+	  && !bitmap_bit_p (cannot_scalarize_away_bitmap,
+			    DECL_UID (root->base)))
 	{
 	  gcc_checking_assert (!root->grp_scalar_read
 			       && !root->grp_assignment_read);