aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-11-03 17:19:30 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2015-11-03 17:19:30 +0000
commit5993d1c9a36c7b029e9ddea35f71d848d822babc (patch)
treef3de57903796486894da59afa2a8a1d3ee7bffd1 /gcc
parent34148d68c7ac0bd2bb1b499b3bd8a267efbe83ad (diff)
downloadgcc-5993d1c9a36c7b029e9ddea35f71d848d822babc.zip
gcc-5993d1c9a36c7b029e9ddea35f71d848d822babc.tar.gz
gcc-5993d1c9a36c7b029e9ddea35f71d848d822babc.tar.bz2
gimple-expr.c (useless_type_conversion_p): Reinstate type canonical check for aggregate types and beef up comment for mode...
* gimple-expr.c (useless_type_conversion_p): Reinstate type canonical check for aggregate types and beef up comment for mode check. From-SVN: r229714
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gimple-expr.c14
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gnat.dg/discr45.adb2
4 files changed, 17 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index d00b074..395b11c 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2015-11-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gimple-expr.c (useless_type_conversion_p): Reinstate type canonical
+ check for aggregate types and beef up comment for mode check.
+
2015-11-03 Richard Biener <rguenther@suse.de>
* tree-vect-data-refs.c (vect_analyze_data_refs): Do not collect
diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c
index f5f9e87..dd2550a 100644
--- a/gcc/gimple-expr.c
+++ b/gcc/gimple-expr.c
@@ -86,7 +86,8 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
if (inner_type == outer_type)
return true;
- /* Changes in machine mode are never useless conversions unless. */
+ /* Changes in machine mode are never useless conversions because the RTL
+ middle-end expects explicit conversions between modes. */
if (TYPE_MODE (inner_type) != TYPE_MODE (outer_type))
return false;
@@ -262,14 +263,13 @@ useless_type_conversion_p (tree outer_type, tree inner_type)
return true;
}
- /* For aggregates compare only the size. Accesses to fields do have
- a type information by themselves and thus we only care if we can i.e.
- use the types in move operations. */
+ /* For aggregates we rely on TYPE_CANONICAL exclusively and require
+ explicit conversions for types involving to be structurally
+ compared types. */
else if (AGGREGATE_TYPE_P (inner_type)
&& TREE_CODE (inner_type) == TREE_CODE (outer_type))
- return (TYPE_MODE (outer_type) != BLKmode
- || operand_equal_p (TYPE_SIZE (inner_type),
- TYPE_SIZE (outer_type), 0));
+ return TYPE_CANONICAL (inner_type)
+ && TYPE_CANONICAL (inner_type) == TYPE_CANONICAL (outer_type);
else if (TREE_CODE (inner_type) == OFFSET_TYPE
&& TREE_CODE (outer_type) == OFFSET_TYPE)
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8b9bf4c..14253d1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2015-11-03 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat.dg/discr45.adb: Only compile the test.
+
2015-11-03 Evgeny Stupachenko <evstupac@gmail.com>
* g++.dg/ext/mvc4.C: Add dg-require-ifunc condition.
diff --git a/gcc/testsuite/gnat.dg/discr45.adb b/gcc/testsuite/gnat.dg/discr45.adb
index 0d0b4dc..5e276c9 100644
--- a/gcc/testsuite/gnat.dg/discr45.adb
+++ b/gcc/testsuite/gnat.dg/discr45.adb
@@ -1,4 +1,4 @@
--- { dg-do run }
+-- { dg-do compile }
-- { dg-options "-O2 -gnatws" }
procedure Discr45 is