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]

[patch PR39806] Potential fix for spurious code generation


This patch is a potential fix for spurious code generation due to struct
reorg (as suggested by Andrew).
As I cannot reproduce it on ppc, please check it on your platform.

Thanks,
Olga

Index: ipa-struct-reorg.c
===================================================================
--- ipa-struct-reorg.c  (revision 154644)
+++ ipa-struct-reorg.c  (working copy)
@@ -569,7 +569,7 @@ static new_var
 is_in_new_vars_htab (tree decl, htab_t new_vars_htab)
 {
   return (new_var) htab_find_with_hash (new_vars_htab, decl,
-                             htab_hash_pointer (decl));
+                             DECL_UID (decl));
 }

 /* Given original variable ORIG_VAR, this function returns
@@ -1962,7 +1962,7 @@ add_to_new_vars_htab (new_var new_node,
   void **slot;

   slot = htab_find_slot_with_hash (new_vars_htab, new_node->orig_var,
-                          htab_hash_pointer (new_node->orig_var),
+                          DECL_UID (new_node->orig_var),
                           INSERT);
   *slot = new_node;
 }
@@ -2254,15 +2254,19 @@ create_new_var (tree var_decl, htab_t ne
 static hashval_t
 new_var_hash (const void *x)
 {
-  return htab_hash_pointer (((const_new_var)x)->orig_var);
+  return DECL_UID (((const_new_var)x)->orig_var);
 }

-/* This function returns nonzero if orig_var of new_var X is equal to Y.
*/
+/* This function returns nonzero if orig_var of new_var X
+   and tree Y have equal UIDs.  */

 static int
 new_var_eq (const void *x, const void *y)
 {
-  return ((const_new_var)x)->orig_var == (const_tree)y;
+  if (DECL_P ((const_tree)y))
+    return DECL_UID (((const_new_var)x)->orig_var) == DECL_UID
((const_tree)y);
+  else
+    return 0;
 }

 /* This function check whether a structure type represented by STR


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