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: [patch]: To cause dataflow to speed up and use less mem.


Seongbae Park (???, ???) wrote:
> These hunks:
>
> @@ -3958,6 +3958,12 @@ if_convert (bool recompute_dominance)
> basic_block bb;
> int pass;
>
> + if (optimize == 1)
> + {
> + df_live_add_problem ();
> + df_live_set_all_dirty ();
> + }
> +
> num_possible_if_blocks = 0;
> num_updated_if_blocks = 0;
> num_true_changes = 0;
> @@ -4039,6 +4045,9 @@ if_convert (bool recompute_dominance)
> num_true_changes);
> }
>
> + if (optimize == 1)
> + df_remove_problem (df_live);
> +
> Index: init-regs.c
> ===================================================================
> --- init-regs.c (revision 125730)
> +++ init-regs.c (working copy)
> @@ -53,6 +53,12 @@ initialize_uninitialized_regs (void)
> basic_block bb;
> bitmap already_genned = BITMAP_ALLOC (NULL);
>
> + if (optimize == 1)
> + {
> + df_live_add_problem ();
> + df_live_set_all_dirty ();
> + }
> +
> df_analyze ();
>
> FOR_EACH_BB (bb)
> @@ -111,6 +117,9 @@ initialize_uninitialized_regs (void)
> }
> }
>
> + if (optimize == 1)
> + df_remove_problem (df_live);
> +
> BITMAP_FREE (already_genned);
> }
>
>
>
> Why check for only optimize == 1 ?
> This looks fragile fragle. Shouldn't you check optimize <= 1 ?
> I know those optimizations are not turned on at 0,
> but still.
> Maybe we want to introduce a global function
> something like df_is_doing_live() or something along those lines
> to common up the checks.
> Basically I don't like to see this check scattered throughout the code.
> This applies equally to other checking against optimize outside
> gate_* functions.
> Other than that, the rest looks fine.
>
This is not as much of an issue as you make it out to be. None of these
optimizations can run at O0 even if someone were to try to force them on
from the command line. The gate function is of the form: if (optimize &&
flag...).

Even if that were to change, the functions would most likely crash
because df is null for most of the O0 time - it is only turned on when
it is really needed.

Kenny



> Seongbae
>
>
> On 6/15/07, Kenneth Zadeck <zadeck@naturalbridge.com> wrote:
>> The original purpose of this patch was to turn off df_live when running
>> at -O1. This means that at -O1, there would only be the old backwards
>> df_lr problem (the info available before the dataflow merge).
>>
>> The effect of doing that appears to be about 1% compile time improvement
>> and most likely some space improvement. This required changing some
>> amount of plumbing to make sure that df_live was not added to the
>> problem stack and changing all of the instances of DF_LIVE_{in|out} to
>> df_get_live_{in|out}.
>>
>> However, it was not as easy as I had hoped. A couple of passes have
>> been changed so that they now really do require the better info. These
>> passes are
>> init-regs and ifcvt.
>>
>> Along the way I discovered a bug, where the code that automatically
>> removes optional passes was not correct. This had the effect of holding
>> on to the df_urec problem for longer than necessary. This has both
>> adverse time and space consequences.
>>
>> On compiling all of the .i files for gcc, this second fix cuts 2 seconds
>> off -O1, -O2, and -O3 out of times of 3:20, 5:10, and 6:15 respectively.
>> The first fix cuts another 2 secs off the -O1 time but has no effect at
>> other levels. All of these times were measured on my x86-64.
>>
>> I do not know how to measure the space. We can look at honza's report
>> after this gets in. I also removed a couple of functions that were
>> never called.
>>
>> This was bootstrapped and regression tested on x86-32, x86-64, ppc-32
>> and ia-64.
>>
>> OK to commit?
>>
>> Kenny
>>
>>
>>
>> 2007-06-15 Kenneth Zadeck <zadeck@naturalbridge.com>
>>
>> * df.h (DF_FIRST_OPTIONAL_PROBLEM): Removed.
>> (struct df_problem.free_blocks_on_set_blocks): New field.
>> (struct dataflow.optional_p): New field.
>> (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
>> (df_live_set_all_dirty): New function.
>> * df-scan.c (df_scan_alloc): Initialize optional_p.
>> (problem_SCAN): Initialize free_blocks_on_set_blocks.
>> * df-core.c (df_set_blocks): Removed use of
>> DF_FIRST_OPTIONAL_PROBLEM. Now uses
>> df_problem.free_blocks_on_set_blocks to determine which blocks are
>> recycled.
>> (df_remove_problem): Removed use of DF_FIRST_OPTIONAL_PROBLEM.
>> (df_finish_pass): Removed use of DF_FIRST_OPTIONAL_PROBLEM. Now
>> uses dataflow.optional_p to determine if problem should be
>> deleted.
>> (rest_of_handle_df_initialize): Only start live problem if
>> -02 or above.
>> (df_bb_regno_last_use_find, df_insn_regno_def_p): Removed.
>> * df-problems.c (df_ru_alloc, df_rd_alloc, df_lr_alloc,
>> df_live_alloc, df_urec_alloc, df_note_alloc): set optional_p.
>> (problem_RU, problem_RD, problem_LR, problem_UREC, problem_CHAIN,
>> problem_NOTE): Initialize free_blocks_on_set_blocks.
>> (df_lr_bb_local_compute): Recompute luids if df_live problem is
>> not active.
>> (df_live_set_all_dirty, df_note_alloc): New function.
>> * regrename.c (merge_overlapping_regs): Change DF_LIVE_* to
>> df_get_live_*.
>> * sched_ebb.c (compute_jump_reg_dependencies): Ditto.
>> * postreload.c (reload_combine): Ditto.
>> * cse.c (cse_extended_basic_block): Ditto.
>> * regmove.c (mark_flags_life_zones): Ditto.
>> * rtlfactoring.c (split_blocks_after_seqs, split_pattern_seq,
>> erase_matching_seqs): Ditto.
>> * bt-load.c (compute_defs_uses_and_gen): Ditto.
>> * integrate (allocate_initial_values): Ditto.
>> * combine.c (reg_dead_at_p): Ditto.
>> * resource.c (mark_target_live_regs): Ditto.
>> * sched-rgn.c (check_live_1, update_live_1): Ditto.
>> * config/frv/frv.c (frv_ifcvt_modify_tests,
>> frv_ifcvt_modify_insn): Ditto.
>> * config/sh/sh.c (find_r0_life_regions): Ditto.
>> * global.c (rest_of_handle_global_alloc): Only add back df_live
>> for -O > 1.
>> * local-alloc.c (rest_of_handle_local_alloc): Only remove
>> df_live for -O > 1.
>> * ifcvt.c (dead_or_predicable): Change DF_LIVE_* to
>> df_get_live_*.
>> (if_convert): Make sure df_live is there at -O == 1.
>> (pass_if_after_combine): Cleanup flags.
>> * init-regs.c (initialize_uninitialized_regs): Make sure df_live
>> is there at -O == 1.
>>


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