This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Less langhook queries from useless_type_conversion_p_1
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Date: Fri, 7 Aug 2009 10:51:23 +0200 (CEST)
- Subject: [PATCH] Less langhook queries from useless_type_conversion_p_1
With the following patch the only thing missing in the middle-end is
code to actually do structural comparison of record types (it exists
on the LTO branch obviously).
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2009-08-07 Richard Guenther <rguenther@suse.de>
* tree-ssa.c (useless_type_conversion_p_1): Only for types
that require structural equality defer to the langhook.
Index: gcc/tree-ssa.c
===================================================================
--- gcc/tree-ssa.c (revision 150526)
+++ gcc/tree-ssa.c (working copy)
@@ -1073,11 +1073,11 @@ useless_type_conversion_p_1 (tree outer_
else if (AGGREGATE_TYPE_P (inner_type)
&& TREE_CODE (inner_type) == TREE_CODE (outer_type))
{
- /* ??? This seems to be necessary even for aggregates that don't
- have TYPE_STRUCTURAL_EQUALITY_P set. */
+ if (TYPE_STRUCTURAL_EQUALITY_P (outer_type)
+ || TYPE_STRUCTURAL_EQUALITY_P (inner_type))
+ return lang_hooks.types_compatible_p (inner_type, outer_type);
- /* ??? This should eventually just return false. */
- return lang_hooks.types_compatible_p (inner_type, outer_type);
+ return false;
}
return false;