On 4/15/2026 8:38 PM, Andrew Pinski wrote:
> This makes a cleanup that is way overdue and should have been done
> years ago. Instead of setting some global/static variables for the
> callback function to check here, we pass down the data to the callback
> function. This reduces the number of global variables (which should help
> with Parallel GCC project). Plus since mfb_keep_just was exported outside
> of cfgloopmanip.cc (it was used in tree-ssa-threadupdate.cc), it reduces
> is shared between files.
>
> I found this useful when working on PR 123113 as I needed a new callback
> function.
>
> Bootstrapped and tested on x86_64-linux-gnu.
>
> gcc/ChangeLog:
>
> * cfghooks.cc (make_forwarder_block): New data argument,
> pass it down to redirect_edge_p.
> * cfghooks.h (make_forwarder_block): Add void* argument.
> * cfgloop.cc (mfb_reis_set): Remove.
> (mfb_redirect_edges_in_set): Add new data argument.
> Use it instead of mfb_reis_set.
> (form_subloop): Create a local variable instead of
> mfb_areis_set. Update call to make_forwarder_block.
> (merge_latch_edges): Likewise.
> * cfgloopmanip.cc (mfb_kj_edge): Remove.
> (mfb_keep_just): Add new data argument.
> Use it instead of mfb_kj_edge.
> (create_preheader): Use local variable instead of
> mfb_kj_edge. Update call to make_forwarder_block.
> * cfgloopmanip.h (mfb_keep_just): Add void* argument.
> * tree-cfgcleanup.cc (mfb_keep_latches): Add unused void* arugment.
> (cleanup_tree_cfg_noloop): Update call to make_forwarder_block.
> * tree-ssa-threadupdate.cc
> (fwd_jt_path_registry::thread_through_loop_header): Use local
> variable instead of mfb_kj_edge. Update call to make_forwarder_block.
s/arugment/argument. OK with that change.
Thanks,
Jeff