This is the mail archive of the gcc-patches@gcc.gnu.org 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]

Re: WHOPR versus passmanager 1


On Mon, Apr 19, 2010 at 10:42 AM, Jan Hubicka <hubicka@ucw.cz> wrote:
> Hi,
> this patch makes WHOPR to use passmanager to do the WPA stage. ?Since streaming
> of optimization summaries is nonexistent or totally wrong, I disabled for now
> all passes except for inliner.
>
> In next step, I would like to add passmanager hooks for optimization summary streamig.
>
> Then cleanup cgraph stramer and split it to two section. ?First section to
> contain cgrpah itself that will be the same for lto/wpa/ltrans streaming and
> the second to contain optimization summaries - that is clone infos, edge flags
> etc. etc.
>
> The idea is that I would realy like to get cgraph section stable across
> releases eventually (we are far from that given that we promplty stream all
> nonsential flags we can think of).
>
> Bootstrapped/regtested x86_64-linux, OK?

Ok.

Btw, we now have a few bugreports of -O0 -fipa-XYZ ICEing,
can you look at disabling all but the IPA inliner (which is of
course needed for now) if not optimizing?

Thanks,
Richard.

> Honza
>
> ? ? ? ?* opts.c (decode_options): Disable whpr incompatible passes.
> ? ? ? ?* lto/lto.c (lto_1_to_1_map): Skip clones.
> ? ? ? ?(read_cgraph_and_symbols): Do not mark everything as needed.
> ? ? ? ?(do_whole_program_analysis): Do map only after optimizing;
> ? ? ? ?set proper cgraph_state; use passmanager.
> Index: opts.c
> ===================================================================
> --- opts.c ? ? ?(revision 158462)
> +++ opts.c ? ? ?(working copy)
> @@ -1120,6 +1120,16 @@ decode_options (unsigned int argc, const
> ? ? ? if (!PARAM_SET_P (PARAM_STACK_FRAME_GROWTH))
> ? ? ? ? PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40;
> ? ? }
> + ?if (flag_wpa || flag_ltrans)
> + ? ?{
> + ? ? ?/* These passes are not WHOPR compatible yet. ?*/
> + ? ? ?flag_ipa_cp = 0;
> + ? ? ?flag_ipa_reference = 0;
> + ? ? ?flag_ipa_pure_const = 0;
> + ? ? ?flag_ipa_type_escape = 0;
> + ? ? ?flag_ipa_pta = 0;
> + ? ? ?flag_ipa_struct_reorg = 0;
> + ? ?}
>
> ? if (flag_lto || flag_whopr)
> ? ? {
> Index: lto/lto.c
> ===================================================================
> --- lto/lto.c ? (revision 158462)
> +++ lto/lto.c ? (working copy)
> @@ -554,6 +554,10 @@ lto_1_to_1_map (void)
>
> ? for (node = cgraph_nodes; node; node = node->next)
> ? ? {
> + ? ? ?/* We will get proper partition based on function they are inlined to or
> + ? ? ? ?cloned from. ?*/
> + ? ? ?if (node->global.inlined_to || node->clone_of)
> + ? ? ? continue;
> ? ? ? /* We only need to partition the nodes that we read from the
> ? ? ? ? gimple bytecode files. ?*/
> ? ? ? file_data = node->local.lto_file_data;
> @@ -1881,19 +1885,9 @@ read_cgraph_and_symbols (unsigned nfiles
> ? /* Finally merge the cgraph according to the decl merging decisions. ?*/
> ? lto_symtab_merge_cgraph_nodes ();
>
> - ?/* Mark cgraph nodes needed in the merged cgraph
> - ? ? This normally happens in whole-program pass, but for
> - ? ? ltrans the pass was already run at WPA phase.
> -
> - ? ? FIXME: ?This is not valid way to do so; nodes can be needed
> - ? ? for non-obvious reasons. ?We should stream the flags from WPA
> - ? ? phase. */
> ? if (flag_ltrans)
> ? ? for (node = cgraph_nodes; node; node = node->next)
> ? ? ? {
> - ? ? ? ?if (!node->global.inlined_to
> - ? ? ? ? ? && cgraph_decide_is_function_needed (node, node->decl))
> - ? ? ? ? ?cgraph_mark_needed_node (node);
> ? ? ? ?/* FIXME: ipa_transforms_to_apply holds list of passes that have optimization
> ? ? ? ? ? summaries computed and needs to apply changes. ?At the moment WHOPR only
> ? ? ? ? ? supports inlining, so we can push it here by hand. ?In future we need to stream
> @@ -1986,9 +1980,6 @@ do_whole_program_analysis (void)
> ?{
> ? char **output_files;
> ? size_t i;
> - ?struct cgraph_node *node;
> -
> - ?lto_1_to_1_map ();
>
> ? /* Note that since we are in WPA mode, materialize_cgraph will not
> ? ? ?actually read in all the function bodies. ?It only materializes
> @@ -1998,20 +1989,12 @@ do_whole_program_analysis (void)
> ? /* Reading in the cgraph uses different timers, start timing WPA now. ?*/
> ? timevar_push (TV_WHOPR_WPA);
>
> - ?/* FIXME lto. Hack. We should use the IPA passes. ?There are a
> - ? ? number of issues with this now. 1. There is no convenient way to
> - ? ? do this. 2. Some passes may depend on properties that requires
> - ? ? the function bodies to compute. ?*/
> ? cgraph_function_flags_ready = true;
> ? bitmap_obstack_initialize (NULL);
> ? ipa_register_cgraph_hooks ();
> + ?cgraph_state = CGRAPH_STATE_IPA_SSA;
>
> - ?/* Reset inlining information before running IPA inliner. ?*/
> - ?for (node = cgraph_nodes; node; node = node->next)
> - ? ?reset_inline_failed (node);
> -
> - ?/* FIXME lto. ?We should not call this function directly. */
> - ?pass_ipa_inline.pass.execute ();
> + ?execute_ipa_pass_list (all_regular_ipa_passes);
>
> ? verify_cgraph ();
> ? bitmap_obstack_release (NULL);
> @@ -2019,6 +2002,8 @@ do_whole_program_analysis (void)
> ? /* We are about to launch the final LTRANS phase, stop the WPA timer. ?*/
> ? timevar_pop (TV_WHOPR_WPA);
>
> + ?lto_1_to_1_map ();
> +
> ? output_files = lto_wpa_write_files ();
>
> ? /* Show the LTO report before launching LTRANS. ?*/
>


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