On 9/7/26 8:43 AM, [email protected] wrote:
From: Kyrylo Tkachov <[email protected]>

The three RTL if-conversion passes were three near-identical rtl_opt_pass
subclasses, and if_convert took a bool after_combine that was stored in the
ifcvt_after_combine file-scope global purely so cheap_bb_rtx_cost_p could
tell the pre-combine run apart from the later ones.

Introduce an ifcvt_phase enum (BEFORE_COMBINE, AFTER_COMBINE, AFTER_RELOAD)
and give if_convert that instead of the bool.  Collapse the three pass
classes into one pass_rtl_ifcvt parameterised on the phase: the phase
selects the gate condition and whether execute cleans up the CFG (ce1) or
just reruns if-conversion (ce2/ce3).  The three pass_data blocks and the
three make_pass_* entry points stay, so the pipeline is unchanged.  No
functional change.

gcc/ChangeLog:

        * ifcvt.cc (enum ifcvt_phase): New.
        (ifcvt_pass_phase): New, replacing...
        (ifcvt_after_combine): ...this.
        (cheap_bb_rtx_cost_p): Test ifcvt_pass_phase.
        (if_convert): Take an ifcvt_phase instead of a bool.
        (rest_of_handle_if_conversion): Adjust caller.
        (pass_if_after_combine, pass_if_after_reload): Remove, folding both
        into...
        (pass_rtl_ifcvt): ...this, now parameterised on the phase.
        (make_pass_rtl_ifcvt, make_pass_if_after_combine,
        make_pass_if_after_reload): Construct it with the matching phase.

Signed-off-by: Kyrylo Tkachov <[email protected]>
OK
jeff

Reply via email to