From 78aa9eb3b402b3199945d3ab09f54895dc753498 Mon Sep 17 00:00:00 2001 From: jamborm Date: Mon, 19 Dec 2011 14:33:18 +0000 Subject: [PATCH] 2011-12-19 Martin Jambor 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@182483 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tree-ssa/pr51583.c | 34 +++++++++++++++++++++++++++++++++ gcc/tree-sra.c | 3 +++ 4 files changed, 49 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr51583.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 974af00..7c60f7e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2011-12-19 Martin Jambor + + 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. + 2011-12-19 Jakub Jelinek * gimple.h (gimplify_seq_add_stmt): Rename to... diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a7c1c48..b1a3762 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-19 Martin Jambor + + PR tree-optimization/51583 + * gcc.dg/tree-ssa/pr51583.c: New test. + 2011-12-19 Jakub Jelinek PR tree-optimization/51596 diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c b/gcc/testsuite/gcc.dg/tree-ssa/pr51583.c new file mode 100644 index 0000000..2c4ec47 --- /dev/null +++ b/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; +} diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 84cbc84..db9b9bf 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -2752,6 +2752,9 @@ load_assign_lhs_subreplacements (struct access *lacc, struct access *top_racc, 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); -- 2.7.4