diff options
author | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-22 19:03:39 +0000 |
---|---|---|
committer | rguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2010-10-22 19:03:39 +0000 |
commit | 96cfc375c157d831b5278901b06c9a3da95691d3 (patch) | |
tree | aba9c0452722f367214fd539f57871adfd8cbd2c | |
parent | a219c38933e767e8ba9ae7a486e9e301bec993f2 (diff) | |
download | gcc-96cfc375c157d831b5278901b06c9a3da95691d3.tar.gz |
2010-10-22 Richard Guenther <rguenther@suse.de>
PR middle-end/46137
* gimple-fold.c (gimplify_and_update_call_from_tree): Properly
remove the virtual operands if they are not needed.
* c-c++-common/torture/pr46137.c: New testcase.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@165852 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/gimple-fold.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/c-c++-common/torture/pr46137.c | 18 |
4 files changed, 31 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5731ffe83e9..3f6e01bedd3 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2010-10-22 Richard Guenther <rguenther@suse.de> + + PR middle-end/46137 + * gimple-fold.c (gimplify_and_update_call_from_tree): Properly + remove the virtual operands if they are not needed. + 2010-10-22 Changpeng Fang <changpeng.fang@amd.com> * gcc/config/i386/i386.c (processor_costs bdver1_cost): Update diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 697e3643528..6862c126c72 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -1044,6 +1044,8 @@ gimplify_and_update_call_from_tree (gimple_stmt_iterator *si_p, tree expr) if (TREE_CODE (gimple_vdef (stmt)) == SSA_NAME) SSA_NAME_DEF_STMT (gimple_vdef (stmt)) = new_stmt; } + else if (reaching_vuse == gimple_vuse (stmt)) + unlink_stmt_vdef (stmt); } gimple_set_location (new_stmt, gimple_location (stmt)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 5c254e10698..1aa51a459bf 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2010-10-22 Richard Guenther <rguenther@suse.de> + + PR middle-end/46137 + * c-c++-common/torture/pr46137.c: New testcase. + 2010-10-22 Jason Merrill <jason@redhat.com> PR c++/46129 diff --git a/gcc/testsuite/c-c++-common/torture/pr46137.c b/gcc/testsuite/c-c++-common/torture/pr46137.c new file mode 100644 index 00000000000..3e44ff6b7c9 --- /dev/null +++ b/gcc/testsuite/c-c++-common/torture/pr46137.c @@ -0,0 +1,18 @@ +/* { dg-do compile } */ + +struct X { }; + +static inline void * +bar (void *dst, void *src) +{ + return __builtin___memcpy_chk (dst, src, sizeof (struct X), + __builtin_object_size (dst, 0)); +} + +struct X +foo (struct X *x) +{ + struct X any; + bar (&any, x); + return any; +} |