This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/44194] struct returned by value generates useless stores
- From: "eraman at google dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 15 Jun 2011 20:34:52 +0000
- Subject: [Bug rtl-optimization/44194] struct returned by value generates useless stores
- Auto-submitted: auto-generated
- References: <bug-44194-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44194
--- Comment #21 from Easwaran Raman <eraman at google dot com> 2011-06-15 20:34:32 UTC ---
The DSE patch still leaves 2 redundant stores. The following patch will enable
DSE to remove those two stores. Does this look ok?
Index: gcc/testsuite/gcc.dg/pr44194-1.c
===================================================================
--- gcc/testsuite/gcc.dg/pr44194-1.c (revision 175082)
+++ gcc/testsuite/gcc.dg/pr44194-1.c (working copy)
@@ -13,5 +13,5 @@ void func() {
struct ints s = foo();
bar(s.a, s.b);
}
-/* { dg-final { scan-rtl-dump "global deletions = 2" "dse1" } } */
+/* { dg-final { scan-rtl-dump "global deletions = 4" "dse1" } } */
/* { dg-final { cleanup-rtl-dump "dse1" } } */
Index: gcc/calls.c
===================================================================
--- gcc/calls.c (revision 175081)
+++ gcc/calls.c (working copy)
@@ -3005,8 +3005,9 @@ expand_call (tree exp, rtx target, int ignore)
tree nt = build_qualified_type (rettype,
(TYPE_QUALS (rettype)
| TYPE_QUAL_CONST));
-
+ tree target_expr = create_tmp_reg (rettype, NULL);
target = assign_temp (nt, 0, 1, 1);
+ set_mem_expr (target, target_expr);
}
if (! rtx_equal_p (target, valreg))