diff options
author | Richard Guenther <rguenther@suse.de> | 2010-03-01 12:56:44 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2010-03-01 12:56:44 +0000 |
commit | 434c8f4b99a89391ee874db02f0395979792eb3f (patch) | |
tree | 203acddae995515ee65514805003aa7a64565cc4 | |
parent | 291c0a12c4a00c0aa5a67e570e3194b808ad6946 (diff) | |
download | gcc-434c8f4b99a89391ee874db02f0395979792eb3f.zip gcc-434c8f4b99a89391ee874db02f0395979792eb3f.tar.gz gcc-434c8f4b99a89391ee874db02f0395979792eb3f.tar.bz2 |
re PR tree-optimization/43213 (Worse code generated with -O2)
2010-03-01 Richard Guenther <rguenther@suse.de>
PR middle-end/43213
* expr.c (expand_assignment): Use the alias-oracle to tell
if the rhs aliases the result decl.
* gcc.dg/pr43213.c: New testcase.
From-SVN: r157142
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/expr.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/pr43213.c | 12 |
4 files changed, 27 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26c5031..8ea24d3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-03-01 Richard Guenther <rguenther@suse.de> + + PR middle-end/43213 + * expr.c (expand_assignment): Use the alias-oracle to tell + if the rhs aliases the result decl. + 2010-03-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> PR pch/14940 @@ -4432,9 +4432,11 @@ expand_assignment (tree to, tree from, bool nontemporal) /* In case we are returning the contents of an object which overlaps the place the value is being stored, use a safe function when copying a value through a pointer into a structure value return block. */ - if (TREE_CODE (to) == RESULT_DECL && TREE_CODE (from) == INDIRECT_REF + if (TREE_CODE (to) == RESULT_DECL + && TREE_CODE (from) == INDIRECT_REF && ADDR_SPACE_GENERIC_P - (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (from, 0))))) + (TYPE_ADDR_SPACE (TREE_TYPE (TREE_TYPE (TREE_OPERAND (from, 0))))) + && refs_may_alias_p (to, from) && cfun->returns_struct && !cfun->returns_pcc_struct) { diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c399e80..fcdfdf7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-03-01 Richard Guenther <rguenther@suse.de> + + PR middle-end/43213 + * gcc.dg/pr43213.c: New testcase. + 2010-03-01 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> * lib/target-supports.exp (check_effective_target_ucn_nocache): diff --git a/gcc/testsuite/gcc.dg/pr43213.c b/gcc/testsuite/gcc.dg/pr43213.c new file mode 100644 index 0000000..d12fb22 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr43213.c @@ -0,0 +1,12 @@ +/* { dg-do compile } */ + +struct S { + int i; +}; + +struct S f(int i) +{ + return *(struct S *)&i; +} + +/* { dg-final { scan-assembler-not "memmove" } } */ |