This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[lto] Fix 8 testsuite failures
- From: Diego Novillo <dnovillo at google dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sun, 31 May 2009 19:45:50 -0400
- Subject: [lto] Fix 8 testsuite failures
This fixes some varargs testsuite failures that were due to gcse
moving a variant expression out of a loop. The problem was that
two references to the same field in __va_list_tag were considered
to be different fields by nonoverlapping_component_refs_p.
This was caused by the streamer creating two different
FIELD_DECLs for the same field in the structure. Since this
structure is created internally (not streamed in), the fix is to
register these fields as preloaded nodes so the sharing mechanism
in the streamer can pick them up.
Tested on x86_64.
Diego.
* lto-section-out.c (preload_common_node): Call
preload_common node on fields of structures.
Index: lto-section-out.c
===================================================================
--- lto-section-out.c (revision 148004)
+++ lto-section-out.c (working copy)
@@ -936,6 +936,19 @@ preload_common_node (tree t, htab_t h, V
#endif
get_ref_idx_for (t, h, v, ref_p);
+
+ /* The FIELD_DECLs of structures should be shared, so that every
+ COMPONENT_REF uses the same tree node when referencing a field.
+ Pointer equality between FIELD_DECLs is used by the alias
+ machinery to compute overlapping memory references (See
+ nonoverlapping_component_refs_p). */
+ if (TREE_CODE (t) == RECORD_TYPE)
+ {
+ tree f;
+
+ for (f = TYPE_FIELDS (t); f; f = TREE_CHAIN (f))
+ preload_common_node (f, h, v, ref_p);
+ }
}