+2011-06-23 Jan Hubicka <jh@suse.cz>
+
+ PR tree-optimize/49373
+ * tree-pass.h (all_late_ipa_passes): Declare.
+ * cgraphunit.c (init_lowered_empty_function): Fix properties.
+ (cgraph_optimize): Execute late passes; remove unreachable funcions after
+ materialization.
+ * ipa-inline.c (gate_ipa_inline): Enable only when optimizing or LTOing.
+ * passes.c (all_late_ipa_passes): Declare.
+ (dump_passes, register_pass): Handle late ipa passes.
+ (init_optimization_passes): Move ipa_pta to late passes; schedule fixup_cfg
+ at beggining of all_passes.
+ (apply_ipa_transforms): New function.
+ (execute_one_pass): When doing simple ipa pass, apply all transforms.
+
2011-06-23 Joseph Myers <joseph@codesourcery.com>
* params.c: Include common/common-target.h. Don't include tm.h.
DECL_SAVED_TREE (decl) = error_mark_node;
cfun->curr_properties |=
(PROP_gimple_lcf | PROP_gimple_leh | PROP_cfg | PROP_referenced_vars |
- PROP_ssa);
+ PROP_ssa | PROP_gimple_any);
/* Create BB for body of the function and connect it properly. */
bb = create_basic_block (NULL, (void *) 0, ENTRY_BLOCK_PTR);
#endif
cgraph_materialize_all_clones ();
+ bitmap_obstack_initialize (NULL);
+ execute_ipa_pass_list (all_late_ipa_passes);
+ cgraph_remove_unreachable_nodes (true, dump_file);
+#ifdef ENABLE_CHECKING
+ verify_cgraph ();
+#endif
+ bitmap_obstack_release (NULL);
cgraph_mark_functions_to_output ();
cgraph_state = CGRAPH_STATE_EXPANSION;
/* The root of the compilation pass tree, once constructed. */
struct opt_pass *all_passes, *all_small_ipa_passes, *all_lowering_passes,
- *all_regular_ipa_passes, *all_lto_gen_passes;
+ *all_regular_ipa_passes, *all_late_ipa_passes, *all_lto_gen_passes;
/* This is used by plugins, and should also be used in register_pass. */
#define DEF_PASS_LIST(LIST) &LIST,
dump_pass_list (all_small_ipa_passes, 1);
dump_pass_list (all_regular_ipa_passes, 1);
dump_pass_list (all_lto_gen_passes, 1);
+ dump_pass_list (all_late_ipa_passes, 1);
dump_pass_list (all_passes, 1);
pop_cfun ();
success |= position_pass (pass_info, &all_regular_ipa_passes);
if (!success || all_instances)
success |= position_pass (pass_info, &all_lto_gen_passes);
+ if (!success || all_instances)
+ success |= position_pass (pass_info, &all_late_ipa_passes);
if (!success || all_instances)
success |= position_pass (pass_info, &all_passes);
if (!success)
NEXT_PASS (pass_ipa_inline);
NEXT_PASS (pass_ipa_pure_const);
NEXT_PASS (pass_ipa_reference);
- NEXT_PASS (pass_ipa_pta);
*p = NULL;
p = &all_lto_gen_passes;
NEXT_PASS (pass_ipa_lto_finish_out); /* This must be the last LTO pass. */
*p = NULL;
+ /* Simple IPA passes executed after the regular passes. In WHOPR mode the
+ passes are executed after partitioning and thus see just parts of the
+ compiled unit. */
+ p = &all_late_ipa_passes;
+ NEXT_PASS (pass_ipa_pta);
+ *p = NULL;
/* These passes are run after IPA passes on every function that is being
output to the assembler file. */
p = &all_passes;
+ NEXT_PASS (pass_fixup_cfg);
NEXT_PASS (pass_lower_eh_dispatch);
NEXT_PASS (pass_all_optimizations);
{
register_dump_files (all_lto_gen_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg);
+ register_dump_files (all_late_ipa_passes,
+ PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
+ | PROP_cfg);
register_dump_files (all_passes,
PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh
| PROP_cfg);
}
}
+/* Callback for do_per_function to apply all IPA transforms. */
+
+static void
+apply_ipa_transforms (void *data)
+{
+ struct cgraph_node *node = cgraph_get_node (current_function_decl);
+ if (!node->global.inlined_to && node->ipa_transforms_to_apply)
+ {
+ *(bool *)data = true;
+ execute_all_ipa_transforms();
+ rebuild_cgraph_edges ();
+ }
+}
+
/* Check if PASS is explicitly disabled or enabled and return
the gate status. FUNC is the function to be processed, and
GATE_STATUS is the gate status determined by pass manager by
executed. */
invoke_plugin_callbacks (PLUGIN_PASS_EXECUTION, pass);
+ /* SIPLE IPA passes do not handle callgraphs with IPA transforms in it.
+ Apply all trnasforms first. */
+ if (pass->type == SIMPLE_IPA_PASS)
+ {
+ bool applied = false;
+ do_per_function (apply_ipa_transforms, (void *)&applied);
+ if (applied)
+ cgraph_remove_unreachable_nodes (true, dump_file);
+ }
+
if (!quiet_flag && !cfun)
fprintf (stderr, " <%s>", pass->name ? pass->name : "");