aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.cc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2022-08-05 13:02:29 +0100
committerPhilip Herron <philip.herron@embecosm.com>2022-08-05 13:03:01 +0100
commitf70783d06336dbd94c63f37dd5623d4ffdc2e4a5 (patch)
tree6747c98ef8dfbea1c7062c3ae0e8480e1a711e3e /gcc/rust/backend/rust-compile-context.cc
parenta39108dea1d091545982fefa88ce3be31b9eedf2 (diff)
downloadgcc-f70783d06336dbd94c63f37dd5623d4ffdc2e4a5.zip
gcc-f70783d06336dbd94c63f37dd5623d4ffdc2e4a5.tar.gz
gcc-f70783d06336dbd94c63f37dd5623d4ffdc2e4a5.tar.bz2
Update the type hasher to stop duplication of aggregate types
The hasher we ported was always calling TYPE_HASH which ends up with DECL_UID which is geneated causing aggregate types keep having a unique hash which ends up confusing the middle end as two copy's of the same aggegate type ends up making GCC think there is some kind of type conversion required here. Fixes #1434
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.cc')
-rw-r--r--gcc/rust/backend/rust-compile-context.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/gcc/rust/backend/rust-compile-context.cc b/gcc/rust/backend/rust-compile-context.cc
index 463ac27..cb2addf6 100644
--- a/gcc/rust/backend/rust-compile-context.cc
+++ b/gcc/rust/backend/rust-compile-context.cc
@@ -62,9 +62,6 @@ Context::type_hasher (tree type)
hstate.add_object (record_name_hash);
}
- if (TREE_TYPE (type))
- hstate.add_object (TYPE_HASH (TREE_TYPE (type)));
-
for (tree t = TYPE_ATTRIBUTES (type); t; t = TREE_CHAIN (t))
/* Just the identifier is adequate to distinguish. */
hstate.add_object (IDENTIFIER_HASH_VALUE (TREE_PURPOSE (t)));
@@ -128,6 +125,16 @@ Context::type_hasher (tree type)
}
break;
+ case BOOLEAN_TYPE:
+ break;
+
+ case REFERENCE_TYPE:
+ case POINTER_TYPE: {
+ hashval_t type_hash = type_hasher (TREE_TYPE (type));
+ hstate.add_object (type_hash);
+ }
+ break;
+
default:
break;
}