This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/23372] [4.0/4.1 Regression] Temporary aggregate copy not elided when passing parameters by value


------- Additional Comments From rguenth at gcc dot gnu dot org  2005-08-29 13:13 -------
One possibility would be to hack out-of-ssa to coalesce single use variables
with their defs in the case of aggregates.  The real fix would involve
expanding to rtl from ssa, so we have this information ready and need not
create these useless memcpy's.  Or whatever solution is more "correct" here
("fixing" the frontends will not work for the second testcase until we allow
function calls as arguments in gimple).

Anyway, here's the hack that passed bootstrapping and regtesting for C and C++
with only some tr1 tests failing:

Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.113.2.11
diff -c -3 -p -r2.113.2.11 gimplify.c
*** gimplify.c  16 Aug 2005 22:16:52 -0000      2.113.2.11
--- gimplify.c  29 Aug 2005 12:04:33 -0000
*************** gimplify_target_expr (tree *expr_p, tree
*** 3628,3633 ****
--- 3628,3641 ----

    if (init)
      {
+       /* Try to avoid the temporary if possible.  */
+       if (TREE_CODE (init) == INDIRECT_REF
+         && !TARGET_EXPR_CLEANUP (targ))
+       {
+         *expr_p = init;
+         return GS_OK;
+       }
+
        /* TARGET_EXPR temps aren't part of the enclosing block, so add it
         to the temps list.  */
       gimple_add_tmp_var (temp);



-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23372


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]