[PATCH] PR rtl-optimization/37922: Replace read clobbers hard regs.

H.J. Lu hjl.tools@gmail.com
Thu Dec 18 14:52:00 GMT 2008


On Thu, Dec 18, 2008 at 5:44 AM, Kenneth Zadeck
<zadeck@naturalbridge.com> wrote:
> Seongbae Park ??? ??? wrote:
>> On Wed, Dec 17, 2008 at 7:19 AM, Kenneth Zadeck
>> <zadeck@naturalbridge.com> wrote:
>>
>>> Replacing a read with shifting operations in dse.c occasionally uses
>>> instructions that set hard regs (like the CC).  This patch makes sure
>>> that the hard regs set by the new code were not already live.
>>>
>>>
>>> 2008-12-17  Kenneth Zadeck <zadeck@naturalbridge.com>
>>>
>>>    PR rtl-optimization/37922
>>>    * dce.c (bb_info): Added regs_live field.
>>>    (look_for_hardregs): New function.
>>>    (replace_read): Added regs_live parameter and code to check that
>>>    shift sequence does not clobber live hardregs.
>>>    (check_mem_read_rtx): Added parameter to replace_read.
>>>    (dse_step1): Added regs_live bitmap and initialize it.
>>>    (rest_of_handle_dse): Added DF_NOTES problem and earlier call to
>>>    df_analyze.
>>>    * df-problems.c (df_simulate_one_insn): Renamed to
>>>    df_simulate_one_insn_backwards.
>>>    (df_simulate_artificial_defs_at_top,
>>>    df_simulate_one_insn_forwards,
>>>    df_simulate_artificial_defs_at_end): New functions.
>>>    * df.h (df_simulate_one_insn): Renamed to
>>>    df_simulate_one_insn_backwards.
>>>    (df_simulate_artificial_defs_at_top,
>>>    df_simulate_one_insn_forwards,
>>>    df_simulate_artificial_defs_at_end): New functions.
>>>    * sel-sched.c (propagate_lv_set): Renamed to
>>>    df_simulate_one_insn_backwards.
>>>    * ifcvt.c (dead_or_predicable): Ditto.
>>>    * recog.c (peephole2_optimize): Ditto.
>>>    * rtl-factoring (collect_pattern_seqs, clear_regs_live_in_seq): Ditto.
>>>
>>> 2008-12-17  Kenneth Zadeck <zadeck@naturalbridge.com>
>>>
>>>    PR rtl-optimization/37922
>>>    * g++.dg/torture/pr37922.C: New test.
>>>
>>> Bootstrapped and regression tested on x86-32 and x86-64.
>>> OK for commit?
>>>
>>
>> The patch looks ok to me.
>> Now that we have full symmetry, it might be a bit more informative to the users
>> if we rename df_simulate_artificial_defs_at_{top,end} to
>> df_initialize_simulate_{forwards,backwards}
>> (or something alone those lines, without mentioning artificial defs) instead.
>>
>> Seongbae
>>
> I did what seonbae suggested plus two other changes suggested by StevenB
> and
> Jakub. These other two changes were to add an assertion to
> df-problems.c:df_simulate_one_insn_forwards to assure that the DF_NOTE
> problem was active and the other was to wrap the code that tests for
> conflicting registers in dse.c:replace_read in a test to see if the
> sequence was not null.
>
> I rebootstrapped and regression tested this on x86-64 and x86-32.
>
> Committed as revision 142809.
>
> Kenny
>
>
> 2008-12-18 Kenneth Zadeck <zadeck@naturalbridge.com>
>
> PR rtl-optimization/37922
> * dse.c (bb_info): Added regs_live field.
> (look_for_hardregs): New function.
> (replace_read): Added regs_live parameter and code to check that
> shift sequence does not clobber live hardregs.
> (check_mem_read_rtx): Added parameter to replace_read.
> (dse_step1): Added regs_live bitmap and initialize it.
> (rest_of_handle_dse): Added DF_NOTES problem and earlier call to
> df_analyze.
> * df-problems.c Renamed to
> df_simulate_initialize_backwards.
> (df_simulate_one_insn): Renamed to
> df_simulate_one_insn_backwards.
> (df_simulate_artificial_refs_at_top): Renamed to
> df_simulate_finalize_backwards.
> (df_simulate_initialized_forwards,
> df_simulate_one_insn_forwards,
> df_simulate_finalize_backwards): New functions.
> * df.h (df_simulate_artificial_refs_at_end): Renamed to
> df_simulate_initialize_backwards.
> (df_simulate_one_insn): Renamed to
> df_simulate_one_insn_backwards.
> (df_simulate_artificial_refs_at_top): Renamed to
> df_simulate_finalize_backwards.
> (df_simulate_initialized_forwards,
> df_simulate_one_insn_forwards,
> df_simulate_finalize_backwards): New functions.
> * ra-conflict.c (global_conflicts): Renamed
> df_simulate_artificial_refs_at_end to
> df_simulate_initialize_backwards.
> * sel-sched.c (propagate_lv_set): Renamed df_simulate_one_insn to
> df_simulate_one_insn_backwards.
> * ifcvt.c (dead_or_predicable): Renamed
> df_simulate_artificial_refs_at_end to
> df_simulate_initialize_backwards. Renamed df_simulate_one_insn to
> df_simulate_one_insn_backwards.
> * recog.c (peephole2_optimize): Ditto.
> * rtl-factoring (collect_pattern_seqs, clear_regs_live_in_seq): Ditto.
>
> 2008-12-18 Kenneth Zadeck <zadeck@naturalbridge.com>
>
> PR rtl-optimization/37922
> * g++.dg/torture/pr37922.C: New test.
>
>

Gcc 4.3 is still broken.


-- 
H.J.



More information about the Gcc-patches mailing list