This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] do not produce useless copies
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 22 Nov 2003 19:52:25 +0100
- Subject: [tree-ssa] do not produce useless copies
Hi,
so something easier than fixing aliasing....
this patch avoid copying of inline functions that are not inlined. For
some reason it saves one failure on x86-64, makes no difference on i686.
Must be unrelated bug.
It makes considerable difference on -O3 compilation (20% on Gerald's
testcase).
Results of testing jhpatch15520-ssaf2:
Differences:
184d183
< FAIL: gfortran.fortran-torture/execute/st_function.f90 compilation, -O2
200,202c199,201
< # of expected passes 2276
< # of unexpected failures 27
< # of untested testcases 17
---
> # of expected passes 2278
> # of unexpected failures 26
> # of untested testcases 16
733a733
> WARNING: program timed out.
737d736
< WARNING: program timed out.
OK?
2003-11-22 Jan Hubicka <jh@suse.cz>
* Makefile.in (tree-optimize.o): Depend on cgraph.h
* tree-optimize.c: Include cgraph.h
(rest_of_compilation): Avoid unnecesary copies.
Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.903.2.138
diff -c -3 -p -r1.903.2.138 Makefile.in
*** Makefile.in 21 Nov 2003 23:17:16 -0000 1.903.2.138
--- Makefile.in 22 Nov 2003 15:37:08 -0000
*************** tree-optimize.o : tree-optimize.c $(TREE
*** 1588,1594 ****
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \
$(GGC_H) output.h diagnostic.h ssa.h errors.h flags.h tree-alias-common.h \
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) toplev.h function.h \
! langhooks.h flags.h cgraph.h tree-inline.h tree-mudflap.h $(GGC_H)
c-simplify.o : c-simplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) errors.h \
$(C_TREE_H) $(C_COMMON_H) diagnostic.h $(TREE_SIMPLE_H) varray.h flags.h \
langhooks.h toplev.h rtl.h $(TREE_FLOW_H) langhooks-def.h \
--- 1588,1594 ----
$(SYSTEM_H) $(RTL_H) $(TREE_H) $(TM_P_H) $(EXPR_H) \
$(GGC_H) output.h diagnostic.h ssa.h errors.h flags.h tree-alias-common.h \
$(TIMEVAR_H) $(TM_H) coretypes.h $(TREE_DUMP_H) toplev.h function.h \
! langhooks.h flags.h cgraph.h tree-inline.h tree-mudflap.h $(GGC_H) cgraph.h
c-simplify.o : c-simplify.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) errors.h \
$(C_TREE_H) $(C_COMMON_H) diagnostic.h $(TREE_SIMPLE_H) varray.h flags.h \
langhooks.h toplev.h rtl.h $(TREE_FLOW_H) langhooks-def.h \
Index: tree-optimize.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree-optimize.c,v
retrieving revision 1.1.4.78
diff -c -3 -p -r1.1.4.78 tree-optimize.c
*** tree-optimize.c 20 Nov 2003 21:21:44 -0000 1.1.4.78
--- tree-optimize.c 22 Nov 2003 15:37:09 -0000
*************** Boston, MA 02111-1307, USA. */
*** 44,49 ****
--- 44,50 ----
#include "tree-inline.h"
#include "tree-mudflap.h"
#include "ggc.h"
+ #include "cgraph.h"
/* Rewrite a function tree to the SSA form and perform the SSA-based
optimizations on it. */
*************** tree_rest_of_compilation (tree fndecl, b
*** 292,298 ****
/* We might need the body of this function so that we can expand
it inline somewhere else. This means not lowering some constructs
such as exception handling. */
! if (DECL_INLINE (fndecl) && flag_inline_trees)
{
saved_tree = lhd_unsave_expr_now (DECL_SAVED_TREE (fndecl));
/* ??? We're saving this value here on the stack. Don't gc it. */
--- 293,299 ----
/* We might need the body of this function so that we can expand
it inline somewhere else. This means not lowering some constructs
such as exception handling. */
! if (cgraph_function_possibly_inlined_p (fndecl))
{
saved_tree = lhd_unsave_expr_now (DECL_SAVED_TREE (fndecl));
/* ??? We're saving this value here on the stack. Don't gc it. */