diff mbox

Remove TREE_STATIC check from constructor folding

Message ID 20100909121404.GA19675@kam.mff.cuni.cz
State New
Headers show

Commit Message

Jan Hubicka Sept. 9, 2010, 12:14 p.m. UTC
Hi,
the TREE_STATIC check in constructor folding disqualify quite many optimizations still and I don't
see any practical value in it.  Doc says that the flag imply static storage being allocated for
constructor, but for folding readonly vars this is probalby irrelevant anyway.

Bootstrapped/regtested x86_64-linux, OK?

Honza

	* tree-ssa-ccp.c (fold_const_aggregate_ref): Do not require STATIC
	flag on constructors.

Comments

Richard Biener Sept. 9, 2010, 12:23 p.m. UTC | #1
On Thu, 9 Sep 2010, Jan Hubicka wrote:

> Hi,
> the TREE_STATIC check in constructor folding disqualify quite many optimizations still and I don't
> see any practical value in it.  Doc says that the flag imply static storage being allocated for
> constructor, but for folding readonly vars this is probalby irrelevant anyway.
> 
> Bootstrapped/regtested x86_64-linux, OK?

Ok.

Thanks,
Richard.

> Honza
> 
> 	* tree-ssa-ccp.c (fold_const_aggregate_ref): Do not require STATIC
> 	flag on constructors.
> Index: tree-ssa-ccp.c
> ===================================================================
> --- tree-ssa-ccp.c	(revision 164002)
> +++ tree-ssa-ccp.c	(working copy)
> @@ -1373,8 +1373,7 @@ fold_const_aggregate_ref (tree t)
>  
>        if (ctor == NULL_TREE
>  	  || (TREE_CODE (ctor) != CONSTRUCTOR
> -	      && TREE_CODE (ctor) != STRING_CST)
> -	  || !TREE_STATIC (ctor))
> +	      && TREE_CODE (ctor) != STRING_CST))
>  	return NULL_TREE;
>  
>        /* Get the index.  If we have an SSA_NAME, try to resolve it
> @@ -1459,8 +1459,7 @@ fold_const_aggregate_ref (tree t)
>  	}
>  
>        if (ctor == NULL_TREE
> -	  || TREE_CODE (ctor) != CONSTRUCTOR
> -	  || !TREE_STATIC (ctor))
> +	  || TREE_CODE (ctor) != CONSTRUCTOR)
>  	return NULL_TREE;
>  
>        field = TREE_OPERAND (t, 1);
> @@ -1526,8 +1525,7 @@ fold_const_aggregate_ref (tree t)
>  
>        if (ctor == NULL_TREE
>  	  || (TREE_CODE (ctor) != CONSTRUCTOR
> -	      && TREE_CODE (ctor) != STRING_CST)
> -	  || !TREE_STATIC (ctor))
> +	      && TREE_CODE (ctor) != STRING_CST))
>  	return NULL_TREE;
>  
>        /* Get the byte offset.  */
> 
>
diff mbox

Patch

Index: tree-ssa-ccp.c
===================================================================
--- tree-ssa-ccp.c	(revision 164002)
+++ tree-ssa-ccp.c	(working copy)
@@ -1373,8 +1373,7 @@  fold_const_aggregate_ref (tree t)
 
       if (ctor == NULL_TREE
 	  || (TREE_CODE (ctor) != CONSTRUCTOR
-	      && TREE_CODE (ctor) != STRING_CST)
-	  || !TREE_STATIC (ctor))
+	      && TREE_CODE (ctor) != STRING_CST))
 	return NULL_TREE;
 
       /* Get the index.  If we have an SSA_NAME, try to resolve it
@@ -1459,8 +1459,7 @@  fold_const_aggregate_ref (tree t)
 	}
 
       if (ctor == NULL_TREE
-	  || TREE_CODE (ctor) != CONSTRUCTOR
-	  || !TREE_STATIC (ctor))
+	  || TREE_CODE (ctor) != CONSTRUCTOR)
 	return NULL_TREE;
 
       field = TREE_OPERAND (t, 1);
@@ -1526,8 +1525,7 @@  fold_const_aggregate_ref (tree t)
 
       if (ctor == NULL_TREE
 	  || (TREE_CODE (ctor) != CONSTRUCTOR
-	      && TREE_CODE (ctor) != STRING_CST)
-	  || !TREE_STATIC (ctor))
+	      && TREE_CODE (ctor) != STRING_CST))
 	return NULL_TREE;
 
       /* Get the byte offset.  */