Commit 670cd5c5 by Jan Hubicka

Makefile.in (ipa-inline.o): Add COEVERAGE_H dependency.


	* Makefile.in (ipa-inline.o): Add COEVERAGE_H dependency.
	* cgraph.c (cgraph_create_node): Reset estimated_growth.
	* cgraph.h (cgraph_global_info): Add estimated_growth.
	* ipa-inline.c: Include coverage.h
	(max_insns, max_count): New static variables.
	(cgraph_estimate_size_after_inlining): Cache the result.
	(cgraph_estimate_growth):
	* passes.c (rest_of_clean_state): Kill coverage_end_function.
	* timevar.def (TV_INLINE_HEURISTICS): New timevar.
	* tree-optimize.c (init_tree_optimization_passes): Move profiling before
	inlining.
	(ipa_passes): Initialize bitmaps.

	* gcc.dg/tree-prof/inliner-1.c: New.

2005-05-25  Janis Johnson  <janis187@us.ibm.com>

	* gcc.dg/tree-prof: New directory.
	* gcc.dg/tree-prof/tree-prof.exp: New.

From-SVN: r100144
parent a71a498d
2005-05-25 Jan Hubicka <jh@suse.cz>
* Makefile.in (ipa-inline.o): Add COEVERAGE_H dependency.
* cgraph.c (cgraph_create_node): Reset estimated_growth.
* cgraph.h (cgraph_global_info): Add estimated_growth.
* ipa-inline.c: Include coverage.h
(max_insns, max_count): New static variables.
(cgraph_estimate_size_after_inlining): Cache the result.
(cgraph_estimate_growth):
* passes.c (rest_of_clean_state): Kill coverage_end_function.
* timevar.def (TV_INLINE_HEURISTICS): New timevar.
* tree-optimize.c (init_tree_optimization_passes): Move profiling before
inlining.
(ipa_passes): Initialize bitmaps.
2005-05-25 Adrian Straetling <straetling@de.ibm.com>
* loop-doloop.c: Include "target.h".
......
......@@ -2064,7 +2064,8 @@ cgraphunit.o : cgraphunit.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
ipa.o : ipa.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(CGRAPH_H)
ipa-inline.o : ipa-inline.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
$(TREE_H) langhooks.h tree-inline.h $(FLAGS_H) $(CGRAPH_H) intl.h \
$(DIAGNOSTIC_H) $(FIBHEAP_H) $(PARAMS_H) $(TIMEVAR_H) tree-pass.h
$(DIAGNOSTIC_H) $(FIBHEAP_H) $(PARAMS_H) $(TIMEVAR_H) tree-pass.h \
$(COVERAGE_H)
coverage.o : coverage.c $(GCOV_IO_H) $(CONFIG_H) $(SYSTEM_H) coretypes.h \
$(TM_H) $(RTL_H) $(TREE_H) $(FLAGS_H) output.h $(REGS_H) $(EXPR_H) \
function.h toplev.h $(GGC_H) langhooks.h $(COVERAGE_H) gt-coverage.h \
......
......@@ -169,6 +169,7 @@ cgraph_create_node (void)
if (cgraph_nodes)
cgraph_nodes->previous = node;
node->previous = NULL;
node->global.estimated_growth = INT_MIN;
cgraph_nodes = node;
cgraph_n_nodes++;
return node;
......
......@@ -69,6 +69,9 @@ struct cgraph_global_info GTY(())
/* Estimated size of the function after inlining. */
int insns;
/* Estimated growth after inlining. INT_MIN if not computed. */
int estimated_growth;
/* Set iff the function has been inlined at least once. */
bool inlined;
};
......
......@@ -1427,7 +1427,6 @@ static void
rest_of_clean_state (void)
{
rtx insn, next;
coverage_end_function ();
/* It is very important to decompose the RTL instruction chain here:
debug information keeps pointing into CODE_LABEL insns inside the function
......
......@@ -1141,6 +1141,7 @@ branch_prob (void)
free_edge_list (el);
if (flag_branch_probabilities)
profile_status = PROFILE_READ;
coverage_end_function ();
}
/* Union find algorithm implementation for the basic blocks using
......
2005-05-25 Jan Hubicka <jh@suse.cz>
* gcc.dg/tree-prof/inliner-1.c: New.
2005-05-25 Janis Johnson <janis187@us.ibm.com>
* gcc.dg/tree-prof: New directory.
* gcc.dg/tree-prof/tree-prof.exp: New.
2005-05-25 DJ Delorie <dj@redhat.com>
* gcc.dg/Wattributes-1.c: New.
......
/* { dg-options "-O2 -fdump-tree-optimized -fdump-tree-all" } */
int a;
int b[100];
void abort (void);
inline void
cold_function ()
{
int i;
for (i = 0; i < 99; i++)
if (b[i] / (b[i+1] + 1))
abort ();
}
inline void
hot_function ()
{
int i;
for (i = 0; i < 99; i++)
if (b[i] / (b[i+1] + 1))
abort ();
}
main ()
{
if (a)
cold_function ();
else
hot_function ();
return 0;
}
/* cold function should be inlined, while hot function should not.
Look for "cold_function () [tail call];" call statement not for the
declaration or other apperances of the string in dump. */
/* { dg-final-use { scan-tree-dump "cold_function ..;" "optimized"} } */
/* { dg-final-use { scan-tree-dump-not "hot_function ..;" "optimized"} } */
# Copyright (C) 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Test the functionality of programs compiled with profile-directed block
# ordering using -fprofile-generate followed by -fprofile-use
load_lib target-supports.exp
# Some targets don't support tree profiling.
if { ![check_profiling_available "-ftree-based-profiling"] } {
return
}
# The procedures in profopt.exp need these parameters.
set tool gcc
set prof_ext "gcda gcno"
# Override the list defined in profopt.exp.
set PROFOPT_OPTIONS [list {}]
if $tracelevel then {
strace $tracelevel
}
# Load support procs.
load_lib profopt.exp
# These are globals used by profopt-execute. The first is options
# needed to generate profile data, the second is options to use the
# profile data.
set profile_option "-ftree-based-profiling -fprofile-generate"
set feedback_option "-ftree-based-profiling -fprofile-use"
foreach src [lsort [glob -nocomplain $srcdir/$subdir/*.c]] {
# If we're only testing specific files and this isn't one of them, skip it.
if ![runtest_file_p $runtests $src] then {
continue
}
profopt-execute $src
}
......@@ -60,6 +60,7 @@ DEFTIMEVAR (TV_CPP , "preprocessing")
DEFTIMEVAR (TV_LEX , "lexical analysis")
DEFTIMEVAR (TV_PARSE , "parser")
DEFTIMEVAR (TV_NAME_LOOKUP , "name lookup")
DEFTIMEVAR (TV_INLINE_HEURISTICS , "inline heuristics")
DEFTIMEVAR (TV_INTEGRATION , "integration")
DEFTIMEVAR (TV_TREE_GIMPLIFY , "tree gimplify")
DEFTIMEVAR (TV_TREE_EH , "tree eh")
......
......@@ -377,11 +377,11 @@ init_tree_optimization_passes (void)
NEXT_PASS (pass_build_cfg);
NEXT_PASS (pass_pre_expand);
NEXT_PASS (pass_warn_function_return);
NEXT_PASS (pass_tree_profile);
*p = NULL;
p = &all_passes;
NEXT_PASS (pass_fixup_cfg);
NEXT_PASS (pass_tree_profile);
NEXT_PASS (pass_init_datastructures);
NEXT_PASS (pass_all_optimizations);
NEXT_PASS (pass_warn_function_noreturn);
......@@ -682,7 +682,9 @@ tree_lowering_passes (tree fn)
void
ipa_passes (void)
{
execute_pass_list (all_ipa_passes);
bitmap_obstack_initialize (NULL);
execute_pass_list (all_ipa_passes);
bitmap_obstack_release (NULL);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment