summaryrefslogtreecommitdiff
path: root/gcc/lto/lto.c
diff options
context:
space:
mode:
authorak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-29 13:14:51 +0000
committerak <ak@138bc75d-0d04-0410-961f-82ee72b054a4>2011-09-29 13:14:51 +0000
commitbadc6cfaaad34c28dcf83d4773943e589bd47322 (patch)
tree572521c2983256f9fae580c8be83c1898f33a849 /gcc/lto/lto.c
parent5684c61c0def2f1ad31c094d19977a66681c6e87 (diff)
downloadgcc-badc6cfaaad34c28dcf83d4773943e589bd47322.tar.gz
Change random seeds to 64bit and drop re-crcing
I had some trouble with random build failures in a large LTO project and it turned out to be random seed collisions in a highly parallel build (thanks to Honza for suggesting that) There were multiple problems: - The way to generate the random seed is not very random (milliseconds time plus pid) and prone to collisions on highly parallel builds - It's only 32bit - Several users take the existing ascii seed and re-CRC32 it again, which doesn't exactly improve it. This patch changes that to: - Always use 64bit seeds as numbers (no re-crcing) - Change all users to use HOST_WIDE_INT - When the user specifies a random seed it's still crc32ed, but only in this case. Passes bootstrap + testsuite on x86_64-linux. gcc/cp: 2011-09-26 Andi Kleen <ak@linux.intel.com> * repo.c (finish_repo): Use HOST_WIDE_INT_PRINT_HEX_PURE. gcc/: 2011-09-26 Andi Kleen <ak@linux.intel.com> * hwint.h (HOST_WIDE_INT_PRINT_HEX_PURE): Add. * lto-streamer.c (lto_get_section_name): Remove crc32_string. Handle numerical random seed. * lto-streamer.h (lto_file_decl_data): Change id to unsigned HOST_WIDE_INT. * toplev.c (random_seed): Add. (init_random_seed): Change for numerical random seed. (get_random_seed): Return as HOST_WIDE_INT. (set_random_seed): Crc32 existing string. * toplev.h (get_random_seed): Change to numercal return. * tree.c (get_file_function_name): Remove CRC. Handle numerical random seed. gcc/lto/: 2011-09-26 Andi Kleen <ak@linux.intel.com> * lto.c (lto_resolution_read): Remove id dumping. (lto_section_with_id): Turn id HOST_WIDE_ID. (create_subid_section_table): Dito. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@179347 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/lto/lto.c')
-rw-r--r--gcc/lto/lto.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c
index 0b1dcb9c8b5..77eb1a15188 100644
--- a/gcc/lto/lto.c
+++ b/gcc/lto/lto.c
@@ -976,9 +976,6 @@ lto_resolution_read (splay_tree file_ids, FILE *resolution, lto_file *file)
}
file_data = (struct lto_file_decl_data *)nd->value;
- if (cgraph_dump_file)
- fprintf (cgraph_dump_file, "Adding resolution %u %u to id %x\n",
- index, r, file_data->id);
VEC_safe_grow_cleared (ld_plugin_symbol_resolution_t, heap,
file_data->resolutions,
max_index + 1);
@@ -990,14 +987,14 @@ lto_resolution_read (splay_tree file_ids, FILE *resolution, lto_file *file)
/* Is the name for a id'ed LTO section? */
static int
-lto_section_with_id (const char *name, unsigned *id)
+lto_section_with_id (const char *name, unsigned HOST_WIDE_INT *id)
{
const char *s;
if (strncmp (name, LTO_SECTION_NAME_PREFIX, strlen (LTO_SECTION_NAME_PREFIX)))
return 0;
s = strrchr (name, '.');
- return s && sscanf (s, ".%x", id) == 1;
+ return s && sscanf (s, "." HOST_WIDE_INT_PRINT_HEX_PURE, id) == 1;
}
/* Create file_data of each sub file id */
@@ -1008,7 +1005,7 @@ create_subid_section_table (void **slot, void *data)
struct lto_section_slot s_slot, *new_slot;
struct lto_section_slot *ls = *(struct lto_section_slot **)slot;
splay_tree file_ids = (splay_tree)data;
- unsigned id;
+ unsigned HOST_WIDE_INT id;
splay_tree_node nd;
void **hash_slot;
char *new_name;
@@ -1080,7 +1077,7 @@ static int lto_create_files_from_ids (splay_tree_node node, void *data)
lto_file_finalize (file_data, lw->file);
if (cgraph_dump_file)
- fprintf (cgraph_dump_file, "Creating file %s with sub id %x\n",
+ fprintf (cgraph_dump_file, "Creating file %s with sub id " HOST_WIDE_INT_PRINT_HEX "\n",
file_data->file_name, file_data->id);
file_data->next = *lw->file_data;
*lw->file_data = file_data;