------- Comment #31 from olga at gcc dot gnu dot org 2008-01-15 14:11 ------- I gave it another push. The following is a patch solving inconsistency of the data structures in struct reorg, and releasing comparison with 0. Please try it together with the Richard's patch. It should give extra XPASS. If it's ok for you, I submit it for gcc-patches.
Thank you, Olga Index: ipa-struct-reorg.c =================================================================== --- ipa-struct-reorg.c (revision 130927) +++ ipa-struct-reorg.c (working copy) @@ -187,7 +187,7 @@ typedef const struct func_alloc_sites *const_fallocs_t; /* All allocation sites in the program. */ -htab_t alloc_sites; +htab_t alloc_sites = NULL; /* New global variables. Generated once for whole program. */ htab_t new_global_vars; @@ -1246,12 +1248,14 @@ s0 = (str0 != length) ? true : false; s1 = (str1 != length) ? true : false; - gcc_assert ((!s0 && s1) || (!s1 && s0)); + gcc_assert (s0 || s1); + /* For now we allow only comparison with 0 or NULL. */ + gcc_assert (integer_zerop (arg0) || integer_zerop (arg1)); - str = s0 ? VEC_index (structure, structures, str0): - VEC_index (structure, structures, str1); - arg = s0 ? arg0 : arg1; - pos = s0 ? 0 : 1; + str = integer_zerop (arg0) ? VEC_index (structure, structures, str1): + VEC_index (structure, structures, str0); + arg = integer_zerop (arg0) ? arg1 : arg0; + pos = integer_zerop (arg0) ? 1 : 0; for (i = 0; VEC_iterate (tree, str->new_types, i, type); i++) { @@ -2339,6 +2343,41 @@ htab_traverse (accs, dump_acc, NULL); } +/* This function is a callback for alloc_sites hashtable + traversal. SLOT is a pointer to fallocs_t. This function + removes all allocations of the structure defined by DATA. */ + +static int +remove_str_allocs_in_func (void **slot, void *data) +{ + fallocs_t fallocs = *(fallocs_t *) slot; + unsigned i = 0; + alloc_site_t *call; + + while (VEC_iterate (alloc_site_t, fallocs->allocs, i, call)) + { + if (call->str == (d_str) data) + VEC_ordered_remove (alloc_site_t, fallocs->allocs, i); + else + i++; + } + + return 1; +} + +/* This function remove all entries corresponding to the STR structure + from alloc_sites hashtable. */ + +static void +remove_str_allocs (d_str str) +{ + if (!str) + return; + + if (alloc_sites) + htab_traverse (alloc_sites, remove_str_allocs_in_func, str); +} + /* This function removes the structure with index I from structures vector. */ static void @@ -2349,7 +2388,11 @@ if (i >= VEC_length (structure, structures)) return; - str = VEC_index (structure, structures, i); + str = VEC_index (structure, structures, i); + + /* Before removing the structure str, we have to remove its + allocations from alloc_sites hashtable. */ + remove_str_allocs (str); free_data_struct (str); VEC_ordered_remove (structure, structures, i); } @@ -2383,8 +2426,12 @@ s0 = (str0 != length) ? true : false; s1 = (str1 != length) ? true : false; + + if (!s0 && !s1) + return false; - if (!((!s0 && s1) || (!s1 && s0))) + /* For now we allow only comparison with 0 or NULL. */ + if (!integer_zerop (arg0) && !integer_zerop (arg1)) return false; return true; -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34483