This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Return_expr expansion tweek
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 30 Jul 2005 09:41:33 +0200
- Subject: Return_expr expansion tweek
Hi,
in the common case where return value is not promoted, we create return
hard reg, that is initialized by return pseudo that is initialized by
temporary. The last copy is unnecesary and in some cases it turns out
to be dificult enought to eliminate via copy propagation to result in
copy instruction in resulting assembly...
Honza
Bootstrapped/regtested i686-pc-gnu-linux, OK?
2005-07-30 Jan Hubicka <jh@suse.cz>
* stmt.c (expand_return): Avoid extra temporary in common path.
Index: stmt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/stmt.c,v
retrieving revision 1.425
diff -c -3 -p -r1.425 stmt.c
*** stmt.c 25 Jun 2005 02:01:05 -0000 1.425
--- stmt.c 29 Jul 2005 22:25:19 -0000
*************** expand_return (tree retval)
*** 1719,1725 ****
tree ot = TREE_TYPE (DECL_RESULT (current_function_decl));
tree nt = build_qualified_type (ot, TYPE_QUALS (ot) | TYPE_QUAL_CONST);
! val = assign_temp (nt, 0, 0, 1);
val = expand_expr (retval_rhs, val, GET_MODE (val), 0);
val = force_not_mem (val);
/* Return the calculated value. */
--- 1719,1730 ----
tree ot = TREE_TYPE (DECL_RESULT (current_function_decl));
tree nt = build_qualified_type (ot, TYPE_QUALS (ot) | TYPE_QUAL_CONST);
! if (REG_P (result_rtl)
! && !HARD_REGISTER_NUM_P (REGNO (result_rtl))
! && TYPE_MODE (nt) == GET_MODE (result_rtl))
! val = result_rtl;
! else
! val = assign_temp (nt, 0, 0, 1);
val = expand_expr (retval_rhs, val, GET_MODE (val), 0);
val = force_not_mem (val);
/* Return the calculated value. */