mirror of
https://gcc.gnu.org/git/gcc.git
synced 2025-01-06 11:03:43 +08:00
re PR tree-optimization/57303 (struct miscompiled at -O1 and above)
2013-05-21 Richard Biener <rguenther@suse.de> PR tree-optimization/57303 * tree-ssa-sink.c (statement_sink_location): Improve killing stmt detection and properly handle self-assignments. * gcc.dg/torture/pr57303.c: New testcase. From-SVN: r199135
This commit is contained in:
parent
0e39213cbb
commit
7ec67e2af8
@ -1,3 +1,9 @@
|
||||
2013-05-21 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/57303
|
||||
* tree-ssa-sink.c (statement_sink_location): Improve killing
|
||||
stmt detection and properly handle self-assignments.
|
||||
|
||||
2013-05-21 Christian Bruel <christian.bruel@st.com>
|
||||
|
||||
* dwarf2out.c (multiple_reg_loc_descriptor): Use dbx_reg_number for
|
||||
|
@ -1,3 +1,8 @@
|
||||
2013-05-21 Richard Biener <rguenther@suse.de>
|
||||
|
||||
PR tree-optimization/57303
|
||||
* gcc.dg/torture/pr57303.c: New testcase.
|
||||
|
||||
2013-05-21 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR tree-optimization/57321
|
||||
|
33
gcc/testsuite/gcc.dg/torture/pr57303.c
Normal file
33
gcc/testsuite/gcc.dg/torture/pr57303.c
Normal file
@ -0,0 +1,33 @@
|
||||
/* { dg-do run } */
|
||||
|
||||
void abort (void);
|
||||
|
||||
struct S0
|
||||
{
|
||||
int f0;
|
||||
};
|
||||
struct S1
|
||||
{
|
||||
struct S0 f0;
|
||||
};
|
||||
|
||||
struct S1 x = { {0} };
|
||||
struct S1 y = { {1} };
|
||||
|
||||
static void
|
||||
foo (struct S0 p)
|
||||
{
|
||||
struct S0 *l = &y.f0;
|
||||
*l = x.f0;
|
||||
if (p.f0)
|
||||
*l = *l;
|
||||
}
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
foo(y.f0);
|
||||
if (y.f0.f0 != 0)
|
||||
abort ();
|
||||
return 0;
|
||||
}
|
@ -331,11 +331,19 @@ statement_sink_location (gimple stmt, basic_block frombb,
|
||||
gimple use_stmt = USE_STMT (use_p);
|
||||
|
||||
/* A killing definition is not a use. */
|
||||
if (gimple_assign_single_p (use_stmt)
|
||||
&& gimple_vdef (use_stmt)
|
||||
&& operand_equal_p (gimple_assign_lhs (stmt),
|
||||
gimple_assign_lhs (use_stmt), 0))
|
||||
continue;
|
||||
if ((gimple_has_lhs (use_stmt)
|
||||
&& operand_equal_p (gimple_assign_lhs (stmt),
|
||||
gimple_get_lhs (use_stmt), 0))
|
||||
|| stmt_kills_ref_p (use_stmt, gimple_assign_lhs (stmt)))
|
||||
{
|
||||
/* If use_stmt is or might be a nop assignment then USE_STMT
|
||||
acts as a use as well as definition. */
|
||||
if (stmt != use_stmt
|
||||
&& ref_maybe_used_by_stmt_p (use_stmt,
|
||||
gimple_assign_lhs (stmt)))
|
||||
return false;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (gimple_code (use_stmt) != GIMPLE_PHI)
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user