> Am 13.12.2025 um 21:06 schrieb Andrew Pinski <[email protected]>:
> 
> While I was looking into the code generation of PR 122727,
> I noticed that TODO_cleanup_cfg could be set from the call to
> execute_fixup_cfg even though cleanupcfg did nothing afterwards.
> This means the forwarder blocks that were just created with
> make_forwarders_with_degenerate_phis are being removed.
> Instead of conditionally unsetting TODO_cleanup_cfg,
> unconditionally unset TODO_cleanup_cfg after the call
> to make_forwarders_with_degenerate_phis. Since we already
> did the cleanup (maybe twice).
> 
> Bootstrapped and tested on x86_64-linux-gnu.

Ok

>    PR tree-optimization/46555
> gcc/ChangeLog:
> 
>    * tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing):
>    Unconditionally set TODO_cleanup_cfg.
> 
> Signed-off-by: Andrew Pinski <[email protected]>
> ---
> gcc/tree-cfgcleanup.cc | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/gcc/tree-cfgcleanup.cc b/gcc/tree-cfgcleanup.cc
> index 093fde93da6..2521e6d09fd 100644
> --- a/gcc/tree-cfgcleanup.cc
> +++ b/gcc/tree-cfgcleanup.cc
> @@ -1409,10 +1409,7 @@ execute_cleanup_cfg_post_optimizing (void)
> {
>   unsigned int todo = execute_fixup_cfg ();
>   if (cleanup_tree_cfg ())
> -    {
> -      todo &= ~TODO_cleanup_cfg;
> -      todo |= TODO_update_ssa;
> -    }
> +    todo |= TODO_update_ssa;
>   maybe_remove_unreachable_handlers ();
>   cleanup_dead_labels ();
>   if (group_case_labels () && cleanup_tree_cfg ())
> @@ -1423,6 +1420,11 @@ execute_cleanup_cfg_post_optimizing (void)
>   if (optimize)
>     make_forwarders_with_degenerate_phis (cfun);
> 
> +  /* Make sure todo does not have cleanup cfg as we don't want
> +     remove the forwarder blocks we just created. cleanup cfg
> +     has already happened.  */
> +  todo &= ~TODO_cleanup_cfg;
> +
>   basic_block bb = single_succ (ENTRY_BLOCK_PTR_FOR_FN (cfun));
>   gimple_stmt_iterator gsi = gsi_start_nondebug_after_labels_bb (bb);
>   /* If the first (and only) bb and the only non debug
> --
> 2.43.0
> 

Reply via email to