This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix problems with tree-sra.c with VIEW_CONVERT_EXPR
- From: Diego Novillo <dnovillo at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 28 Jun 2004 16:14:16 -0400
- Subject: Re: Fix problems with tree-sra.c with VIEW_CONVERT_EXPR
- Organization: Red Hat Canada
- References: <10406282005.AA02534@vlsi1.ultra.nyu.edu>
On Mon, 2004-06-28 at 16:05, Richard Kenner wrote:
> That was *one* case. I thought you were asking about the reason for
> handling the LHS, which was that case.
>
> The first case I ran into was
>
> <MODIFY_EXPR v1 <COMPONENT_REF <VIEW_CONVERT_EXPR v2> fld>>
>
> where v2 was scalarized but v1 was *not*.
>
Aha, OK. Assuming that the above is valid GIMPLE (jason?), I guess we
need to make is_sra_candidate_ref and scalarize_modify_expr a bit
smarter.
Would this solve your problem? Oh, and where are we running into this?
Is this on the testsuite?
Index: tree-sra.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-sra.c,v
retrieving revision 2.8
diff -d -u -p -r2.8 tree-sra.c
--- tree-sra.c 22 Jun 2004 03:06:41 -0000 2.8
+++ tree-sra.c 28 Jun 2004 20:11:12 -0000
@@ -178,7 +178,8 @@ is_sra_candidate_ref (tree exp, bool all
case COMPONENT_REF:
case REALPART_EXPR:
case IMAGPART_EXPR:
- return is_sra_candidate_decl (TREE_OPERAND (exp, 0));
+ case VIEW_CONVERT_EXPR:
+ return is_sra_candidate_decl (get_base_address (exp));
default:
break;
@@ -917,6 +918,9 @@ scalarize_modify_expr (block_stmt_iterat
tree lhs = TREE_OPERAND (stmt, 0);
tree rhs = TREE_OPERAND (stmt, 1);
+ if (TREE_CODE (rhs) == VIEW_CONVERT_EXPR)
+ rhs = TREE_OPERAND (rhs, 0);
+
/* Found AGGREGATE.FIELD = ... */
if (is_sra_candidate_ref (lhs, false))
{
@@ -953,7 +957,7 @@ scalarize_modify_expr (block_stmt_iterat
operations. */
else if (is_sra_candidate_ref (rhs, true))
{
- tree var = TREE_OPERAND (rhs, 0);
+ tree var = get_base_address (rhs);
emit_scalar_copies (si_p, var, var, FIELD_SCALAR);
}