This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH, PR 51583] One more missing force_gimple_operand in SRA
- From: Martin Jambor <mjambor at suse dot cz>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Cc: Richard Guenther <rguenther at suse dot de>
- Date: Sat, 17 Dec 2011 02:16:34 +0100
- Subject: [PATCH, PR 51583] One more missing force_gimple_operand in SRA
Hi,
when I was fixing PR 50622, somehow I lost a hunk in the patch along
the way. I punished myself by making up an ICEing testcase which is
included alongside the fix below. The fix is needed for trunk and
also in the 4.6 branch.
I have bootstrapped and tested the patch on x86_64-linux on top of
trunk without any problems, a bootstrap and testsuite run on top of
the 4.6 branch is currently running. OK for both if it passes?
Thanks,
Martin
2011-12-16 Martin Jambor <mjambor@suse.cz>
PR tree-optimization/51583
* tree-sra.c (load_assign_lhs_subreplacements): Call
force_gimple_operand_gsi when necessary also in case of no
corresponding replacement on the RHS.
* testsuite/gcc.dg/tree-ssa/pr51583.c: New test.
Index: src/gcc/tree-sra.c
===================================================================
--- src.orig/gcc/tree-sra.c
+++ src/gcc/tree-sra.c
@@ -2752,6 +2752,9 @@ load_assign_lhs_subreplacements (struct
else
rhs = build_ref_for_model (loc, top_racc->base, offset, lacc,
new_gsi, true);
+ if (lacc->grp_partial_lhs)
+ rhs = force_gimple_operand_gsi (new_gsi, rhs, true, NULL_TREE,
+ false, GSI_NEW_STMT);
}
stmt = gimple_build_assign (get_access_replacement (lacc), rhs);
Index: src/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c
===================================================================
--- /dev/null
+++ src/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c
@@ -0,0 +1,34 @@
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+typedef __complex__ double Value;
+
+union U
+{
+ Value v;
+ char c[sizeof(Value)];
+};
+
+struct S
+{
+ union U u;
+ int i,j;
+};
+
+Value gv;
+int gi, gj;
+
+Value foo (void)
+{
+ struct S s,t;
+
+ t.i = gi;
+ t.j = gj;
+ t.u.v = gv;
+ t.u.c[0] = 0;
+
+ s = t;
+ __imag__ s.u.v += s.i;
+
+ return s.u.v;
+}