[patch] Fix properties for pass manager
Steven Bosscher
stevenb.gcc@gmail.com
Fri Apr 3 20:17:00 GMT 2009
On Tue, Mar 10, 2009 at 12:31 PM, Richard Guenther
<richard.guenther@gmail.com> wrote:
> On Mon, Mar 9, 2009 at 11:37 PM, Steven Bosscher <stevenb.gcc@gmail.com> wrote:
>> Hi,
>>
>> There are lies, damn lies, and GCC passes.
>>
>> GCC has passes that falsely claim to provide properties, just to avoid
>> crashing in the properties checkers. The problem is the pass_lower_omp
>> pass, which has a gate function. The result is that PROP_gimple_lomp
>> is never set unless -fopenmp is given. But some passes require
>> PASS_gimple_lomp, via the fake property PROP_trees which is actually a
>> union of properties that are available after fully lowering GIMPLE.
>> So we had IPA passes cheating, claiming to provide "PROP_trees".
>>
>> I believe there should be a general rule for the pass properties that
>> GCC currently does not honor: There should be exactly one pass that
>> provides a property. With the attached patch applied, this is
>> actually the case, but it is not checked (nor enforced via the
>> existing properties checking). I intend to submit a patch for 4.5
>> that adds this checking. Comments/thoughts on this idea?
>
> It certainly makes sense.
>
>> Patch is still bootstrapping on ia64. OK for GCC 4.5 if
>> bootstrap/testing finishes successfully?
>
> Looks good. Ok.
Commited now as r145518.
Ciao!
Steven
* omp-low.c (pass_expand_omp): Don't claim to provide PROP_gimple_lomp.
(execute_lower_omp): Always run but take the short way out if -fopenmp
is not given.
(gate_lower_omp): Remove, forcing the pass manager to always run the
pass and always set PROP_gimple_lomp.
(pass_lower_omp): Remove gate function.
* matrix-reorg.c (pass_ipa_matrix_reorg): Don't claim to provide
PROP_trees.
* ipa-cp.c (pass_ipa_cp): Likewise.
* ipa-inline.c (pass_early_inline): Don't claim to provide PROP_cfg.
(pass_ipa_early_inline, pass_inline_parameters, pass_ipa_inline): Idem.
* tree-profile.c (pass_tree_profile): Don't claim to provide PROP_cfg
and PROP_gimple_leh.
Index: ipa-cp.c
===================================================================
--- ipa-cp.c (revision 145517)
+++ ipa-cp.c (working copy)
@@ -1382,7 +1382,7 @@ struct ipa_opt_pass pass_ipa_cp =
0, /* static_pass_number */
TV_IPA_CONSTANT_PROP, /* tv_id */
0, /* properties_required */
- PROP_trees, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_cgraph | TODO_dump_func |
Index: omp-low.c
===================================================================
--- omp-low.c (revision 145517)
+++ omp-low.c (working copy)
@@ -5456,7 +5456,7 @@ struct gimple_opt_pass pass_expand_omp =
0, /* static_pass_number */
0, /* tv_id */
PROP_gimple_any, /* properties_required */
- PROP_gimple_lomp, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func /* todo_flags_finish */
@@ -6577,6 +6577,11 @@ execute_lower_omp (void)
{
gimple_seq body;
+ /* This pass always runs, to provide PROP_gimple_lomp.
+ But there is nothing to do unless -fopenmp is given. */
+ if (flag_openmp == 0)
+ return 0;
+
all_contexts = splay_tree_new (splay_tree_compare_pointers, 0,
delete_omp_context);
@@ -6604,18 +6609,12 @@ execute_lower_omp (void)
return 0;
}
-static bool
-gate_lower_omp (void)
-{
- return flag_openmp != 0;
-}
-
struct gimple_opt_pass pass_lower_omp =
{
{
GIMPLE_PASS,
"omplower", /* name */
- gate_lower_omp, /* gate */
+ NULL, /* gate */
execute_lower_omp, /* execute */
NULL, /* sub */
NULL, /* next */
Index: ipa-inline.c
===================================================================
--- ipa-inline.c (revision 145517)
+++ ipa-inline.c (working copy)
@@ -1561,7 +1561,7 @@ struct gimple_opt_pass pass_early_inline
0, /* static_pass_number */
TV_INLINE_HEURISTICS, /* tv_id */
0, /* properties_required */
- PROP_cfg, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_func /* todo_flags_finish */
@@ -1591,7 +1591,7 @@ struct simple_ipa_opt_pass pass_ipa_earl
0, /* static_pass_number */
TV_INLINE_HEURISTICS, /* tv_id */
0, /* properties_required */
- PROP_cfg, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_cgraph /* todo_flags_finish */
@@ -1653,7 +1653,7 @@ struct gimple_opt_pass pass_inline_param
0, /* static_pass_number */
TV_INLINE_HEURISTICS, /* tv_id */
0, /* properties_required */
- PROP_cfg, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
0 /* todo_flags_finish */
@@ -1772,7 +1772,7 @@ struct ipa_opt_pass pass_ipa_inline =
0, /* static_pass_number */
TV_INLINE_HEURISTICS, /* tv_id */
0, /* properties_required */
- PROP_cfg, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
TODO_remove_functions, /* todo_flags_finish */
TODO_dump_cgraph | TODO_dump_func
Index: matrix-reorg.c
===================================================================
--- matrix-reorg.c (revision 145517)
+++ matrix-reorg.c (working copy)
@@ -2421,7 +2421,7 @@ struct simple_ipa_opt_pass pass_ipa_matr
0, /* static_pass_number */
0, /* tv_id */
0, /* properties_required */
- PROP_trees, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_dump_cgraph | TODO_dump_func /* todo_flags_finish */
Index: tree-profile.c
===================================================================
--- tree-profile.c (revision 145517)
+++ tree-profile.c (working copy)
@@ -492,7 +492,7 @@ struct gimple_opt_pass pass_tree_profile
0, /* static_pass_number */
TV_BRANCH_PROB, /* tv_id */
PROP_gimple_leh | PROP_cfg, /* properties_required */
- PROP_gimple_leh | PROP_cfg, /* properties_provided */
+ 0, /* properties_provided */
0, /* properties_destroyed */
0, /* todo_flags_start */
TODO_verify_stmts | TODO_dump_func /* todo_flags_finish */
More information about the Gcc-patches
mailing list