Hi Vladimir,

I'll send V3 patchs based on these comments. Note that these four patches only support subreg liveness tracking and apply to IRA and LRA pass. Therefore, no performance changes are expected before we support subreg coalesce. There will be new patches later to complete the subreg coalesce functionality. Support for subreg coalesce requires support for subreg copy i.e. modifying the logic for conflict detection.

On 2024/5/2 00:24, Vladimir Makarov wrote:

On 2/3/24 05:50, Lehua Ding wrote:
This patch apply the DF_LIVE_SUBREG to LRA pass. More changes were made
to the LRA than the IRA since the LRA will modify the DF data directly.
The main big changes are centered on the lra-lives.cc file.

gcc/ChangeLog:

        * lra-coalesce.cc (update_live_info): Extend to DF_LIVE_SUBREG.
        (lra_coalesce): Ditto.
        * lra-constraints.cc (update_ebb_live_info): Ditto.
        (get_live_on_other_edges): Ditto.
        (inherit_in_ebb): Ditto.
        (lra_inheritance): Ditto.
        (fix_bb_live_info): Ditto.
        (remove_inheritance_pseudos): Ditto.
        * lra-int.h (GCC_LRA_INT_H): include subreg-live-range.h
        (struct lra_insn_reg): Add op filed to record the corresponding rtx.
        * lra-lives.cc (class bb_data_pseudos): Extend the bb_data_pseudos to
        include new partial_def/use and range_def/use fileds for DF_LIVE_SUBREG
        problem.
Typo "fileds".
        (need_track_subreg_p): checking is the regno need to be tracked.
        (make_hard_regno_live): switch to live_subreg filed.
The same typo.
        (make_hard_regno_dead): Ditto.
        (mark_regno_live): Support record subreg liveness.
        (mark_regno_dead): Ditto.
        (live_trans_fun): Adjust transfer function to support subreg liveness.
        (live_con_fun_0): Adjust Confluence function to support subreg liveness.
        (live_con_fun_n): Ditto.
        (initiate_live_solver): Ditto.
        (finish_live_solver): Ditto.
        (process_bb_lives): Ditto.
        (lra_create_live_ranges_1): Dump subreg liveness.
        * lra-remat.cc (dump_candidates_and_remat_bb_data): Switch to
        DF_LIVE_SUBREG df data.
        (calculate_livein_cands): Ditto.
        (do_remat): Ditto.
        * lra-spills.cc (spill_pseudos): Ditto.
        * lra.cc (new_insn_reg): New argument op.
        (add_regs_to_insn_regno_info): Add new argument op.

The patch is ok for me with some minor requests:

You missed log entry for collect_non_operand_hard_regs.  Log entry for lra_create_live_ranges_1 is not full (at least, it should be "Ditto. ...").

Also you changed signature for functions update_live_info, fix_bb_live_info, mark_regno_live, mark_regno_dead, new_insn_reg but did not updated the function comments.  Outdated comments are even worse than the comment absence.  Please fix them.

Also some variable naming could be improved but it is up to you.

So now you need just an approval for the rest patches to commit your work but they are not my area responsibility.

It is difficult predict for patches of this size how they will work for other targets.  I tested you patches on aarch64 and ppc64le. They seems working right but please be prepare to switch them off (it is easy) if the patches create some issues for other targets, of course until fixing the issues.

And thank you for your contribution.  Improving GCC performance these days is a challenging task as so many people are working on GCC but you found such opportunity and most importantly implement it.



--
Best,
Lehua

Reply via email to