summaryrefslogtreecommitdiff
path: root/gcc/gimple.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-20 09:35:44 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-05-20 09:35:44 +0000
commitc9819bb0b71ef1482e77c91e7959500fcf261de0 (patch)
tree1ca1ea014fa59c5fb0c6b4ef9a6e23a39a9201f6 /gcc/gimple.c
parent4d83607ae96643ed8e4ead883633924681665638 (diff)
downloadgcc-c9819bb0b71ef1482e77c91e7959500fcf261de0.tar.gz
2011-05-20 Richard Guenther <rguenther@suse.de>
PR middle-end/48849 * gimple.c (gimple_register_canonical_type): Compute TYPE_CANONICAL of pointer types the same way the middle-end does. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@173939 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/gimple.c')
-rw-r--r--gcc/gimple.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 5b03e15a1fc..4c7fbfc8235 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -4801,6 +4801,25 @@ gimple_register_canonical_type (tree t)
if (TYPE_CANONICAL (t))
return TYPE_CANONICAL (t);
+ /* For pointer and reference types do as the middle-end does - the
+ canonical type is a pointer to the canonical pointed-to type. */
+ if (TREE_CODE (t) == POINTER_TYPE)
+ {
+ TYPE_CANONICAL (t)
+ = build_pointer_type_for_mode
+ (gimple_register_canonical_type (TREE_TYPE (t)),
+ TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
+ return TYPE_CANONICAL (t);
+ }
+ else if (TREE_CODE (t) == REFERENCE_TYPE)
+ {
+ TYPE_CANONICAL (t)
+ = build_reference_type_for_mode
+ (gimple_register_canonical_type (TREE_TYPE (t)),
+ TYPE_MODE (t), TYPE_REF_CAN_ALIAS_ALL (t));
+ return TYPE_CANONICAL (t);
+ }
+
if (gimple_canonical_types == NULL)
gimple_canonical_types = htab_create_ggc (16381, gimple_canonical_type_hash,
gimple_canonical_type_eq, 0);