]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
final_cleanupcfg: Make sure TODO_cleanup_cfg is unset master trunk
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 13 Dec 2025 09:23:13 +0000 (01:23 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Sat, 13 Dec 2025 20:51:58 +0000 (12:51 -0800)
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.

PR tree-optimization/46555
gcc/ChangeLog:

* tree-cfgcleanup.cc (execute_cleanup_cfg_post_optimizing):
Unconditionally set TODO_cleanup_cfg.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/tree-cfgcleanup.cc

index 093fde93da6d436a0db459fb85a4a61b30305d32..2521e6d09fd5a50e973923dfa7f6237a0077c752 100644 (file)
@@ -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