aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2018-11-06 11:26:44 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2018-11-06 10:26:44 +0000
commit2a98b4bfc3d952f0c5b71419a5eba51553dcc776 (patch)
treeb886c9b6ac6a5824c39d4a0eee6707238ee10274 /gcc
parent23cab40dba566b17e1d05157c33b78030cfc175a (diff)
downloadgcc-2a98b4bfc3d952f0c5b71419a5eba51553dcc776.zip
gcc-2a98b4bfc3d952f0c5b71419a5eba51553dcc776.tar.gz
gcc-2a98b4bfc3d952f0c5b71419a5eba51553dcc776.tar.bz2
tbaa-1.c: New testcase.
* gcc.dg/lto/tbaa-1.c: New testcase. * tree.c (fld_type_variant): Copy canonical type. (fld_incomplete_type_of): Check that canonical types looks sane; copy canonical type. (verify_type): Accept when incomplete type has complete canonical type. From-SVN: r265835
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.dg/lto/tbaa-1.c41
-rw-r--r--gcc/tree.c7
4 files changed, 58 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index eb867d5..90b4699 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+018-11-06 Jan Hubicka <jh@suse.cz>
+
+ * tree.c (fld_type_variant): Copy canonical type.
+ (fld_incomplete_type_of): Check that canonical types looks sane;
+ copy canonical type.
+ (verify_type): Accept when incomplete type has complete canonical type.
+
2018-11-06 Jan Hubicka <jh@suse.cz>
* tree.c (free_lang_data): Reset overwite_assembler_name,
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 225850d..1ba1eaf 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-11-06 Jan Hubicka <jh@suse.cz>
+
+ * gcc.dg/lto/tbaa-1.c: New testcase.
+
2018-11-06 Richard Biener <rguenther@suse.de>
PR tree-optimization/87889
diff --git a/gcc/testsuite/gcc.dg/lto/tbaa-1.c b/gcc/testsuite/gcc.dg/lto/tbaa-1.c
new file mode 100644
index 0000000..74c0496
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/lto/tbaa-1.c
@@ -0,0 +1,41 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -flto -fdump-tree-evrp" } */
+typedef struct rtx_def *rtx;
+typedef struct cselib_val_struct
+{
+ union
+ {
+ } u;
+ struct elt_loc_list *locs;
+}
+cselib_val;
+struct elt_loc_list
+{
+ struct elt_loc_list *next;
+ rtx loc;
+};
+static int n_useless_values;
+unchain_one_elt_loc_list (pl)
+ struct elt_loc_list **pl;
+{
+ struct elt_loc_list *l = *pl;
+ *pl = l->next;
+}
+
+discard_useless_locs (x, info)
+ void **x;
+{
+ cselib_val *v = (cselib_val *) * x;
+ struct elt_loc_list **p = &v->locs;
+ int had_locs = v->locs != 0;
+ while (*p)
+ {
+ unchain_one_elt_loc_list (p);
+ p = &(*p)->next;
+ }
+ if (had_locs && v->locs == 0)
+ {
+ n_useless_values++;
+ }
+}
+/* { dg-final { scan-tree-dump-times "n_useless_values" 2 "evrp" } } */
diff --git a/gcc/tree.c b/gcc/tree.c
index 15fc99d..f3fce96 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -5118,6 +5118,7 @@ fld_type_variant (tree first, tree t, struct free_lang_data_d *fld)
TYPE_ADDR_SPACE (v) = TYPE_ADDR_SPACE (t);
TYPE_NAME (v) = TYPE_NAME (t);
TYPE_ATTRIBUTES (v) = TYPE_ATTRIBUTES (t);
+ TYPE_CANONICAL (v) = TYPE_CANONICAL (t);
add_tree_to_fld_list (v, fld);
return v;
}
@@ -5146,6 +5147,8 @@ fld_incomplete_type_of (tree t, struct free_lang_data_d *fld)
else
first = build_reference_type_for_mode (t2, TYPE_MODE (t),
TYPE_REF_CAN_ALIAS_ALL (t));
+ gcc_assert (TYPE_CANONICAL (t2) != t2
+ && TYPE_CANONICAL (t2) == TYPE_CANONICAL (TREE_TYPE (t)));
add_tree_to_fld_list (first, fld);
return fld_type_variant (first, t, fld);
}
@@ -5169,6 +5172,7 @@ fld_incomplete_type_of (tree t, struct free_lang_data_d *fld)
SET_TYPE_MODE (copy, VOIDmode);
SET_TYPE_ALIGN (copy, BITS_PER_UNIT);
TYPE_SIZE_UNIT (copy) = NULL;
+ TYPE_CANONICAL (copy) = TYPE_CANONICAL (t);
if (AGGREGATE_TYPE_P (t))
{
TYPE_FIELDS (copy) = NULL;
@@ -13887,7 +13891,8 @@ verify_type (const_tree t)
with variably sized arrays because their sizes possibly
gimplified to different variables. */
&& !variably_modified_type_p (ct, NULL)
- && !gimple_canonical_types_compatible_p (t, ct, false))
+ && !gimple_canonical_types_compatible_p (t, ct, false)
+ && COMPLETE_TYPE_P (t))
{
error ("TYPE_CANONICAL is not compatible");
debug_tree (ct);