------- Comment #2 from rguenth at gcc dot gnu dot org 2009-01-11 14:29 -------
This hits tramp3d a lot, we end up with
D.919534 = VIEW_CONVERT_EXPR<const struct
Loc>(D.919509.D.78313.D.78008).D.78313.D.78008.domain_m[0].D.77181.D.47055.D.46936.domain_m;
vs. D.919509.D.78313.D.78008...
the following fixes it:
Index: gcc/tree-ssa-forwprop.c
===================================================================
--- gcc/tree-ssa-forwprop.c (revision 143251)
+++ gcc/tree-ssa-forwprop.c (working copy)
@@ -775,10 +775,13 @@ forward_propagate_addr_expr_1 (tree name
&& !TYPE_VOLATILE (TREE_TYPE (rhs))
&& !TYPE_VOLATILE (TREE_TYPE (TREE_OPERAND (def_rhs, 0)))
&& operand_equal_p (TYPE_SIZE (TREE_TYPE (rhs)),
- TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))),
0))
+ TYPE_SIZE (TREE_TYPE (TREE_OPERAND (def_rhs, 0))), 0)
+ && (rhs2 = get_base_address (TREE_OPERAND (def_rhs, 0))) != NULL_TREE
+ && !INDIRECT_REF_P (rhs2))
{
tree new_rhs = unshare_expr (TREE_OPERAND (def_rhs, 0));
new_rhs = fold_build1 (VIEW_CONVERT_EXPR, TREE_TYPE (rhs), new_rhs);
+ STRIP_USELESS_TYPE_CONVERSION (new_rhs);
if (TREE_CODE (new_rhs) != VIEW_CONVERT_EXPR)
{
/* If we have folded the VIEW_CONVERT_EXPR then the result is only
--
rguenth at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |pinskia at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38748