This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [tree-profiling-branch PATCH IPCP extensions + Function cloning


> Hello,
> 
> This is a resubmission of the patch 
> http://gcc.gnu.org/ml/gcc-patches/2005-01/msg00336.html, 
>  after changes done according to the feedback received.

Hi,

Index: cgraphunit.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cgraphunit.c,v
retrieving revision 1.1.4.35.2.40
diff -c -3 -p -r1.1.4.35.2.40 cgraphunit.c
*** cgraphunit.c	18 Jan 2005 18:24:18 -0000	1.1.4.35.2.40
--- cgraphunit.c	20 Jan 2005 12:04:31 -0000
*************** static void cgraph_analyze_function (str
*** 181,187 ****
     record_calls_1.  */
  static struct pointer_set_t *visited_nodes;
  
! static FILE *cgraph_dump_file;
  
  /* Determine if function DECL is needed.  That is, visible to something
     either outside this translation unit, something magic in the system
--- 181,187 ----
     record_calls_1.  */
  static struct pointer_set_t *visited_nodes;
  
! /*static*/ FILE *cgraph_dump_file;
  
  /* Determine if function DECL is needed.  That is, visible to something
     either outside this translation unit, something magic in the system
*************** cgraph_optimize (void)
*** 1185,1192 ****
      if (!vnode->non_ipa)
        ipa_analyze_variable (vnode);
  
!   if (flag_ipa_cp && flag_ipa_no_cloning)
!     ipcp_driver ();
    if (cgraph_dump_file)
      {
        fprintf (cgraph_dump_file, "Marked ");
--- 1183,1196 ----
      if (!vnode->non_ipa)
        ipa_analyze_variable (vnode);
  
!     /*if (flag_ipa_cp)
!     {
!       ipcp_driver ();*/
!       /* Clean the callgraph.  */
!     /*  cgraph_remove_unreachable_nodes (true, dump_file);
!     }*/
! 
! 
    if (cgraph_dump_file)
      {
        fprintf (cgraph_dump_file, "Marked ");
*************** copy_cfg_body (inline_data *id, gcov_typ
*** 989,994 ****
--- 1021,1027 ----
  	     next exit block.  */
  	  if (old_src_index >= 0 && old_dest_index >= 0)
  	    {
+ 	     
  	      new = make_edge (new_bb,
  			       VARRAY_BB (new_bb_info, old_dest_index),
  			       old_edge->flags);
*************** copy_cfg_body (inline_data *id, gcov_typ
*** 1081,1095 ****
  	  exit_probability -= old_edge->probability;
  	  exit_count -= old_edge->count;
  	}
!       new = make_edge (BASIC_BLOCK (last_basic_block-1), EXIT_BLOCK_PTR,
  		       EDGE_FALLTHRU);
        new->probability = exit_probability;
        new->count = exit_count;
      }
    id->copy_basic_block = (basic_block)0;
    if (!saving_or_cloning)
      VARRAY_FREE (new_bb_info);
! 
    DECL_SAVED_TREE (new_fndecl) = ENTRY_BLOCK_PTR->next_bb->stmt_list;
  
    pop_cfun ();
--- 1117,1145 ----
  	  exit_probability -= old_edge->probability;
  	  exit_count -= old_edge->count;
  	}
!       /*if (!id->versioning_p)
! 	new = make_edge (BASIC_BLOCK (last_basic_block-1), EXIT_BLOCK_PTR,
  		       EDGE_FALLTHRU);
+       else
+       {*/
+ 	  bb2 = EXIT_BLOCK_PTR_FOR_FUNCTION(cfun_to_copy);
+ 	  if (bb2->preds)
+ 	    {	     
+ 	      FOR_EACH_EDGE(e_step,ei,bb2->preds)
+ 		{
+ 		  bb1 = e_step->src;
+ 		  new = make_edge (BASIC_BLOCK (bb1->index), EXIT_BLOCK_PTR,
+ 				   e_step->flags);
+ 		}
+ 	    }
+ 	  /*	} */
        new->probability = exit_probability;
        new->count = exit_count;
      }
    id->copy_basic_block = (basic_block)0;
    if (!saving_or_cloning)
      VARRAY_FREE (new_bb_info);
!   
    DECL_SAVED_TREE (new_fndecl) = ENTRY_BLOCK_PTR->next_bb->stmt_list;
  
    pop_cfun ();
*************** copy_tree_r (tree *tp, int *walk_subtree
*** 3107,3112 ****
--- 3158,3170 ----
        tree chain = TREE_CHAIN (*tp);
        tree new;
  
+       if (id && id->versioning_p)
+ 	if (replace_ref_tree (id, tp))
+ 	  {
+ 	    *walk_subtrees = 0;
+ 	    return NULL_TREE;
+ 	  }
+ 
        /* Copy the node.  */
        new = copy_node (*tp);
  

The patch is OK assuming that you kill all the commented out code from
the patch and nested conditional above (there are few other examples of
commented out code in the larger + hunks later in patch too)....

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]