mirror of git://gcc.gnu.org/git/gcc.git
				
				
				
			LTO balanced map: add stats about insns and symbols.
* lto-partition.c (new_partition): Reset number of symbols. (add_symbol_to_partition_1): Increment number of symbols. (undo_partition): Decrement number of symbols. (lto_balanced_map): Dump number of symbols and insns that belong to a partition. * lto-partition.h (struct ltrans_partition_def): Add symbol counter. From-SVN: r223750
This commit is contained in:
		
							parent
							
								
									4d45be537b
								
							
						
					
					
						commit
						faae53f8ca
					
				|  | @ -1,3 +1,12 @@ | ||||||
|  | 2015-05-27  Martin Liska  <mliska@suse.cz> | ||||||
|  | 
 | ||||||
|  | 	* lto-partition.c (new_partition): Reset number of symbols. | ||||||
|  | 	(add_symbol_to_partition_1): Increment number of symbols. | ||||||
|  | 	(undo_partition): Decrement number of symbols. | ||||||
|  | 	(lto_balanced_map): Dump number of symbols and insns that | ||||||
|  | 	belong to a partition. | ||||||
|  | 	* lto-partition.h (struct ltrans_partition_def): Add symbol counter. | ||||||
|  | 
 | ||||||
| 2015-05-22  Jan Hubicka  <hubicka@ucw.cz> | 2015-05-22  Jan Hubicka  <hubicka@ucw.cz> | ||||||
| 
 | 
 | ||||||
| 	* lto.c (hash_canonical_type): Be sure we hash only types that | 	* lto.c (hash_canonical_type): Be sure we hash only types that | ||||||
|  |  | ||||||
|  | @ -73,6 +73,7 @@ new_partition (const char *name) | ||||||
|   part->encoder = lto_symtab_encoder_new (false); |   part->encoder = lto_symtab_encoder_new (false); | ||||||
|   part->name = name; |   part->name = name; | ||||||
|   part->insns = 0; |   part->insns = 0; | ||||||
|  |   part->symbols = 0; | ||||||
|   ltrans_partitions.safe_push (part); |   ltrans_partitions.safe_push (part); | ||||||
|   return part; |   return part; | ||||||
| } | } | ||||||
|  | @ -157,6 +158,8 @@ add_symbol_to_partition_1 (ltrans_partition part, symtab_node *node) | ||||||
|   gcc_assert (c != SYMBOL_EXTERNAL |   gcc_assert (c != SYMBOL_EXTERNAL | ||||||
| 	      && (c == SYMBOL_DUPLICATE || !symbol_partitioned_p (node))); | 	      && (c == SYMBOL_DUPLICATE || !symbol_partitioned_p (node))); | ||||||
| 
 | 
 | ||||||
|  |   part->symbols++; | ||||||
|  | 
 | ||||||
|   lto_set_symtab_encoder_in_partition (part->encoder, node); |   lto_set_symtab_encoder_in_partition (part->encoder, node); | ||||||
| 
 | 
 | ||||||
|   if (symbol_partitioned_p (node)) |   if (symbol_partitioned_p (node)) | ||||||
|  | @ -274,6 +277,7 @@ undo_partition (ltrans_partition partition, unsigned int n_nodes) | ||||||
|     { |     { | ||||||
|       symtab_node *node = lto_symtab_encoder_deref (partition->encoder, |       symtab_node *node = lto_symtab_encoder_deref (partition->encoder, | ||||||
| 						   n_nodes); | 						   n_nodes); | ||||||
|  |       partition->symbols--; | ||||||
|       cgraph_node *cnode; |       cgraph_node *cnode; | ||||||
| 
 | 
 | ||||||
|       /* After UNDO we no longer know what was visited.  */ |       /* After UNDO we no longer know what was visited.  */ | ||||||
|  | @ -462,7 +466,7 @@ lto_balanced_map (int n_lto_partitions) | ||||||
|   auto_vec<varpool_node *> varpool_order; |   auto_vec<varpool_node *> varpool_order; | ||||||
|   int i; |   int i; | ||||||
|   struct cgraph_node *node; |   struct cgraph_node *node; | ||||||
|   int total_size = 0, best_total_size = 0; |   int original_total_size, total_size = 0, best_total_size = 0; | ||||||
|   int partition_size; |   int partition_size; | ||||||
|   ltrans_partition partition; |   ltrans_partition partition; | ||||||
|   int last_visited_node = 0; |   int last_visited_node = 0; | ||||||
|  | @ -488,6 +492,8 @@ lto_balanced_map (int n_lto_partitions) | ||||||
| 	  total_size += inline_summaries->get (node)->size; | 	  total_size += inline_summaries->get (node)->size; | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|  |   original_total_size = total_size; | ||||||
|  | 
 | ||||||
|   /* Streaming works best when the source units do not cross partition
 |   /* Streaming works best when the source units do not cross partition
 | ||||||
|      boundaries much.  This is because importing function from a source |      boundaries much.  This is because importing function from a source | ||||||
|      unit tends to import a lot of global trees defined there.  We should |      unit tends to import a lot of global trees defined there.  We should | ||||||
|  | @ -782,6 +788,23 @@ lto_balanced_map (int n_lto_partitions) | ||||||
|   add_sorted_nodes (next_nodes, partition); |   add_sorted_nodes (next_nodes, partition); | ||||||
| 
 | 
 | ||||||
|   free (order); |   free (order); | ||||||
|  | 
 | ||||||
|  |   if (symtab->dump_file) | ||||||
|  |     { | ||||||
|  |       fprintf (symtab->dump_file, "\nPartition sizes:\n"); | ||||||
|  |       unsigned partitions = ltrans_partitions.length (); | ||||||
|  | 
 | ||||||
|  |       for (unsigned i = 0; i < partitions ; i++) | ||||||
|  | 	{ | ||||||
|  | 	  ltrans_partition p = ltrans_partitions[i]; | ||||||
|  | 	  fprintf (symtab->dump_file, "partition %d contains %d (%2.2f%%)" | ||||||
|  | 		   " symbols and %d (%2.2f%%) insns\n", i, p->symbols, | ||||||
|  | 		   100.0 * p->symbols / n_nodes, p->insns, | ||||||
|  | 		   100.0 * p->insns / original_total_size); | ||||||
|  | 	} | ||||||
|  | 
 | ||||||
|  |       fprintf (symtab->dump_file, "\n"); | ||||||
|  |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /* Return true if we must not change the name of the NODE.  The name as
 | /* Return true if we must not change the name of the NODE.  The name as
 | ||||||
|  |  | ||||||
|  | @ -26,6 +26,7 @@ struct ltrans_partition_def | ||||||
|   lto_symtab_encoder_t encoder; |   lto_symtab_encoder_t encoder; | ||||||
|   const char * name; |   const char * name; | ||||||
|   int insns; |   int insns; | ||||||
|  |   int symbols; | ||||||
|   hash_set<symtab_node *> *initializers_visited; |   hash_set<symtab_node *> *initializers_visited; | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 Martin Liska
						Martin Liska