Release RTL bodies after compilation (sometimes)

Jeffrey A Law law@redhat.com
Tue Sep 14 21:07:00 GMT 2004


On Tue, 2004-09-14 at 14:00, Jan Hubicka wrote:
> 2004-09-10  Jan Hubicka  <jh@suse.cz>
> 	* tree-cfg.c (remove_bb): Release SSA defs.
> 	* tree-ssa-alias.c (init_alias_info): Do not walk pointers in freelist.
> 	* tree-ssa-loop-ivopts (remove_statements): Release SSA defs.
> 	* tree-ssa.c (verify_flow_sensitive_alias_info): Do not walk dead nodes.
> 	* tree-tailcall.c (eliminate_tail_call): Release SSA name.

> 
> Index: tree-cfg.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-cfg.c,v
> retrieving revision 2.47
> diff -c -3 -p -r2.47 tree-cfg.c
> *** tree-cfg.c	6 Sep 2004 10:07:56 -0000	2.47
> --- tree-cfg.c	7 Sep 2004 13:26:46 -0000
> *************** remove_bb (basic_block bb)
> *** 1818,1823 ****
> --- 1818,1824 ----
>     for (i = bsi_start (bb); !bsi_end_p (i); bsi_remove (&i))
>       {
>         tree stmt = bsi_stmt (i);
> +       release_defs (stmt);
>   
>         set_bb_for_stmt (stmt, NULL);
This is probably OK.

> Index: tree-ssa-alias.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-alias.c,v
> retrieving revision 2.28
> diff -c -3 -p -r2.28 tree-ssa-alias.c
> *** tree-ssa-alias.c	6 Sep 2004 10:08:05 -0000	2.28
> --- tree-ssa-alias.c	7 Sep 2004 13:26:46 -0000
> *************** init_alias_info (void)
> *** 417,423 ****
>   	{
>   	  tree name = ssa_name (i);
>   
> ! 	  if (!POINTER_TYPE_P (TREE_TYPE (name)))
>   	    continue;
>   
>   	  if (SSA_NAME_PTR_INFO (name))
> --- 417,423 ----
>   	{
>   	  tree name = ssa_name (i);
>   
> ! 	  if (SSA_NAME_IN_FREE_LIST (name) || !POINTER_TYPE_P (TREE_TYPE (name)))
>   	    continue;
>   
>   	  if (SSA_NAME_PTR_INFO (name))
If there's any reason to clear released entries in the formal
SSA_NAME table, this is it.  The fact that right now any code that
wants to walk over the table and perform actions on the names found
therein has to check if the returned name was released or not
is rather prone to hidden errors.


> Index: tree-ssa-loop-ivopts.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa-loop-ivopts.c,v
> retrieving revision 2.3
> diff -c -3 -p -r2.3 tree-ssa-loop-ivopts.c
> *** tree-ssa-loop-ivopts.c	6 Sep 2004 18:38:27 -0000	2.3
> --- tree-ssa-loop-ivopts.c	7 Sep 2004 13:26:47 -0000
> *************** remove_statement (tree stmt, bool includ
> *** 3777,3782 ****
> --- 3777,3784 ----
>         block_stmt_iterator bsi = stmt_for_bsi (stmt);
>   
>         bsi_remove (&bsi);
> +       if (including_defined_name)
> +         release_defs (stmt);
>       }
>   }
Don't know enough about the IV code to comment.

>   
> Index: tree-ssa.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-ssa.c,v
> retrieving revision 2.32
> diff -c -3 -p -r2.32 tree-ssa.c
> *** tree-ssa.c	6 Sep 2004 10:08:11 -0000	2.32
> --- tree-ssa.c	7 Sep 2004 13:26:47 -0000
> *************** verify_flow_sensitive_alias_info (void)
> *** 408,413 ****
> --- 408,415 ----
>         struct ptr_info_def *pi;
>   
>         ptr = ssa_name (i);
> +       if (!TREE_VISITED (ptr))
> + 	continue;
>         ann = var_ann (SSA_NAME_VAR (ptr));
>         pi = SSA_NAME_PTR_INFO (ptr);
>   
Err, the code already does this about 2 lines after your change.  Is
there some reason you couldn't just move the existing test (which
is more comprehensive than yours) to the earlier location?

> Index: tree-tailcall.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/tree-tailcall.c,v
> retrieving revision 2.23
> diff -c -3 -p -r2.23 tree-tailcall.c
> *** tree-tailcall.c	6 Sep 2004 10:08:13 -0000	2.23
> --- tree-tailcall.c	7 Sep 2004 13:26:47 -0000
> *************** eliminate_tail_call (struct tailcall *t)
> *** 681,692 ****
>     bsi_next (&bsi);
>     while (!bsi_end_p (bsi))
>       {
>         /* Do not remove the return statement, so that redirect_edge_and_branch
>   	 sees how the block ends.  */
> !       if (TREE_CODE (bsi_stmt (bsi)) == RETURN_EXPR)
>   	break;
>   
>         bsi_remove (&bsi);
>       }
>   
>     /* Replace the call by a jump to the start of function.  */
> --- 681,694 ----
>     bsi_next (&bsi);
>     while (!bsi_end_p (bsi))
>       {
> +       tree t = bsi_stmt (bsi);
>         /* Do not remove the return statement, so that redirect_edge_and_branch
>   	 sees how the block ends.  */
> !       if (TREE_CODE (t) == RETURN_EXPR)
>   	break;
>   
>         bsi_remove (&bsi);
> +       release_defs (t);
>       }
Is RETURN_EXPR still allowed to create definitions?

>   
>     /* Replace the call by a jump to the start of function.  */
> *************** eliminate_tail_call (struct tailcall *t)
> *** 772,777 ****
> --- 774,780 ----
>       }
>   
>     bsi_remove (&t->call_bsi);
> +   release_defs (call);
>   }
>   
>   /* Optimizes the tailcall described by T.  If OPT_TAILCALLS is true, also
Probably OK.




More information about the Gcc-patches mailing list