This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[4.5 CFT] enabling predictive commoning at -O2? (PR34163)
- From: Paolo Bonzini <bonzini at gnu dot org>
- To: luisgpm at linux dot vnet dot ibm dot com, hjl dot tools at gmail dot com, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 16 Feb 2009 11:22:10 +0100
- Subject: [4.5 CFT] enabling predictive commoning at -O2? (PR34163)
The attached patch enables predictive commoning without unrolling at
-O2. However, it might affect performance negatively (see for example
http://gcc.gnu.org/ml/gcc-patches/2008-07/msg01801.html).
I wonder if someone could try SPEC2006 on it (with the patch, "-O2
-fno-predictive-commoning" vs. "-O2")? I can do SPEC2000 on
i686-pc-linux-gnu.
Paolo
2009-02-16 Paolo Bonzini <bonzini@gnu.org>
* opts.c (flag_predictive_commoning_set): Remove.
(common_handle_option): Do not set it nor use it.
(decode_options): Enable predictive commoning at -O2.
* tree-predcom.c (determine_unroll_factor): Do not unroll
at -O2 -fno-unroll-loops.
Index: opts.c
===================================================================
--- opts.c (revision 144097)
+++ opts.c (working copy)
@@ -351,7 +351,7 @@ static bool flag_unroll_loops_set, flag_
static bool flag_value_profile_transformations_set;
static bool flag_peel_loops_set, flag_branch_probabilities_set;
static bool flag_inline_functions_set, flag_ipa_cp_set, flag_ipa_cp_clone_set;
-static bool flag_predictive_commoning_set, flag_unswitch_loops_set, flag_gcse_after_reload_set;
+static bool flag_unswitch_loops_set, flag_gcse_after_reload_set;
/* Functions excluded from profiling. */
@@ -918,6 +918,7 @@ decode_options (unsigned int argc, const
flag_rerun_cse_after_loop = opt2;
flag_caller_saves = opt2;
flag_peephole2 = opt2;
+ flag_predictive_commoning = opt2;
#ifdef INSN_SCHEDULING
flag_schedule_insns = opt2;
flag_schedule_insns_after_reload = opt2;
@@ -945,7 +946,6 @@ decode_options (unsigned int argc, const
/* -O3 optimizations. */
opt3 = (optimize >= 3);
- flag_predictive_commoning = opt3;
flag_inline_functions = opt3;
flag_unswitch_loops = opt3;
flag_gcse_after_reload = opt3;
@@ -1829,8 +1829,6 @@ common_handle_option (size_t scode, cons
if (!flag_ipa_cp_clone_set
&& value && flag_ipa_cp)
flag_ipa_cp_clone = value;
- if (!flag_predictive_commoning_set)
- flag_predictive_commoning = value;
if (!flag_unswitch_loops_set)
flag_unswitch_loops = value;
if (!flag_gcse_after_reload_set)
@@ -2014,10 +2012,6 @@ common_handle_option (size_t scode, cons
flag_ipa_cp_clone_set = true;
break;
- case OPT_fpredictive_commoning:
- flag_predictive_commoning_set = true;
- break;
-
case OPT_funswitch_loops:
flag_unswitch_loops_set = true;
break;
Index: tree-predcom.c
===================================================================
--- tree-predcom.c (revision 144097)
+++ tree-predcom.c (working copy)
@@ -1791,6 +1791,9 @@ determine_unroll_factor (VEC (chain_p, h
unsigned factor = 1, af, nfactor, i;
unsigned max = PARAM_VALUE (PARAM_MAX_UNROLL_TIMES);
+ if (optimize < 3 && !flag_unroll_loops)
+ return 1;
+
for (i = 0; VEC_iterate (chain_p, chains, i, chain); i++)
{
if (chain->type == CT_INVARIANT || chain->combined)