This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] more useless type conversions
- From: Richard Henderson <rth at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Nov 2003 16:20:32 -0800
- Subject: [tree-ssa] more useless type conversions
Part 1 of several cleaning up generated C++ code. Here we're failing
to look past casts of pointers to typedefs.
We should probably make same_type_p a language-independent function
and consider any pointer equality test for same-type-ness a bug...
r~
* tree-ssa.c (tree_ssa_useless_type_conversion): Use TYPE_MAIN_VARIANT
when compariing pointer types too.
Index: tree-ssa.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa.c,v
retrieving revision 1.1.4.153
diff -c -p -d -r1.1.4.153 tree-ssa.c
*** tree-ssa.c 16 Nov 2003 11:00:40 -0000 1.1.4.153
--- tree-ssa.c 18 Nov 2003 00:11:30 -0000
*************** tree_ssa_useless_type_conversion (tree e
*** 3009,3015 ****
/* Pointers and references are equivalent once we get to GENERIC,
so strip conversions that just switch between them. */
else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)
! && TREE_TYPE (inner_type) == TREE_TYPE (outer_type))
return true;
/* If both the inner and outer types are integral types, then
--- 3009,3016 ----
/* Pointers and references are equivalent once we get to GENERIC,
so strip conversions that just switch between them. */
else if (POINTER_TYPE_P (inner_type) && POINTER_TYPE_P (outer_type)
! && (TYPE_MAIN_VARIANT (TREE_TYPE (inner_type))
! == TYPE_MAIN_VARIANT (TREE_TYPE (outer_type))))
return true;
/* If both the inner and outer types are integral types, then