This is the mail archive of the 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]

[pretty-ipa] ipa-profile cleanups

this patch makes ipa-profile closer to form mergeable into the mainline.
Building SPEC2000 GCC it promotes about 300 functions into unlikely or executed
once and leads to about 2% code size savings.  Not that earthshaking but it is
a start, nightly testing will show results on other tests.

bootstrapped/regtested x86_64-linux and comitted to pretty-ipa.

	* doc/invoke.texi (-fipa-profile): Document.
	* opts.c (decode_options): Enable ipa-profile at -O1.
	* timevar.def (TV_IPA_PROFILE): Define.
	* common.opt (fipa-profile): Add.
	* ipa-profile.c (gate_profile): Use flag_ipa_profile.
	(pass_ipa_profile): Use TV_IPA_PROFILE.
Index: doc/invoke.texi
--- doc/invoke.texi	(revision 158471)
+++ doc/invoke.texi	(working copy)
@@ -344,7 +344,7 @@ Objective-C and Objective-C++ Dialects}.
 -fgcse-sm -fif-conversion -fif-conversion2 -findirect-inlining @gol
 -finline-functions -finline-functions-called-once -finline-limit=@var{n} @gol
 -finline-small-functions -fipa-cp -fipa-cp-clone -fipa-matrix-reorg -fipa-pta @gol
--fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
+-fipa-profile -fipa-pure-const -fipa-reference -fipa-struct-reorg @gol
 -fipa-type-escape -fira-algorithm=@var{algorithm} @gol
 -fira-region=@var{region} -fira-coalesce @gol
 -fira-loop-pressure -fno-ira-share-save-slots @gol
@@ -6590,6 +6590,17 @@ Perform interprocedural pointer analysis
 and reference analysis.  This option can cause excessive memory and
 compile-time usage on large compilation units.  It is not enabled by
 default at any optimization level.
+Enabled by default at @option{-O} and higher.
+@item -fipa-profile
+@opindex fipa-profile
+Perform interprocedural profile propagation.  The functions called only from
+cold functions are marked as cold. Also functions executed once (such as
+@samp{cold}, @samp{noreturn}, static constructors or destructors) are identified. Cold
+functions and loop less parts of functions executed once are then optimized for
+This flag is enabled by default at @option{-O1}.
 @item -fipa-cp
 @opindex fipa-cp
Index: opts.c
--- opts.c	(revision 158471)
+++ opts.c	(working copy)
@@ -858,6 +858,7 @@ decode_options (unsigned int argc, const
   flag_if_conversion2 = opt1;
   flag_ipa_pure_const = opt1;
   flag_ipa_reference = opt1;
+  flag_ipa_profile = opt1;
   flag_merge_constants = opt1;
   flag_split_wide_types = opt1;
   flag_tree_ccp = opt1;
Index: timevar.def
--- timevar.def	(revision 158408)
+++ timevar.def	(working copy)
@@ -60,6 +60,7 @@ DEFTIMEVAR (TV_WHOPR_LTRANS          , "
 DEFTIMEVAR (TV_WHOPR_WPA_FIXUP       , "whopr wpa fixup")
 DEFTIMEVAR (TV_WHOPR_WPA_LTRANS_EXEC , "whopr wpa->ltrans")
 DEFTIMEVAR (TV_IPA_REFERENCE         , "ipa reference")
+DEFTIMEVAR (TV_IPA_PROFILE           , "ipa profile")
 DEFTIMEVAR (TV_IPA_PURE_CONST        , "ipa pure const")
 DEFTIMEVAR (TV_IPA_TYPE_ESCAPE       , "ipa type escape")
 DEFTIMEVAR (TV_IPA_PTA               , "ipa points-to")
Index: common.opt
--- common.opt	(revision 158408)
+++ common.opt	(working copy)
@@ -709,14 +709,18 @@ fipa-cp-clone
 Common Report Var(flag_ipa_cp_clone) Optimization
 Perform cloning to make Interprocedural constant propagation stronger
-Common Report Var(flag_ipa_pure_const) Init(0) Optimization
-Discover pure and const functions
+Common Report Var(flag_ipa_profile) Init(0) Optimization
+Perform interprocedural profile propagation
 Common Report Var(flag_ipa_pta) Init(0) Optimization
 Perform interprocedural points-to analysis
+Common Report Var(flag_ipa_pure_const) Init(0) Optimization
+Discover pure and const functions
 Common Report Var(flag_ipa_reference) Init(0) Optimization
 Discover readonly and non addressable static variables
Index: ipa-profile.c
--- ipa-profile.c	(revision 158408)
+++ ipa-profile.c	(working copy)
@@ -119,7 +119,7 @@ propagate (void)
 static bool
 gate_profile (void)
-  return true;
+  return flag_ipa_profile;
 struct ipa_opt_pass_d pass_ipa_profile =
@@ -132,7 +132,7 @@ struct ipa_opt_pass_d pass_ipa_profile =
   NULL,					/* sub */
   NULL,					/* next */
   0,					/* static_pass_number */
-  TV_IPA_REFERENCE,		        /* tv_id */
+  TV_IPA_PROFILE,		        /* tv_id */
   0,	                                /* properties_required */
   0,					/* properties_provided */
   0,					/* properties_destroyed */

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