]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Have TODO_verify_* not set by any pass
authorAndrew Pinski <quic_apinski@quicinc.com>
Fri, 30 May 2025 06:50:08 +0000 (23:50 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Sat, 31 May 2025 16:30:22 +0000 (09:30 -0700)
This is a follow up to the patch set starting at https://gcc.gnu.org/pipermail/gcc-patches/2014-April/386650.html.

Currently TODO_verify_{il,all} is set by a few passes as TODOs afterwards but
we don't need to do that any more. Those were mostly removed back in
https://gcc.gnu.org/pipermail/gcc-patches/2014-May/387647.html

And now since TODO_verify_all is no longer used, remove it too.
Removes last_verified from the function structure since it is always 0 before the
call to execute_todo that has TODO_verify_all set on it.

Also this removes the ability for good to use TODO_verify_il from the passes and reserves
bit 31 of the TODO for the verfification and internally only the passes.cc code.

gcc/ChangeLog:

* function.h (struct function): Remove last_verified.
* gimple-harden-conditionals.cc (pass_data_harden_compares): Remove
TODO_verify_il.
(pass_data_harden_conditional_branches): Likewise.
* gimple-harden-control-flow.cc (pass_harden_control_flow_redundancy::execute):
Don't return TODO_verify_il.
* ipa-strub.cc (pass_data_ipa_strub): Remove TODO_verify_il.
* passes.cc (TODO_verify_il): Define.
(execute_function_todo): Don't use or set last_verified.
(clear_last_verified): Remove.
(execute_one_ipa_transform_pass): Update comment before execute_todo.
Assert that none of the todos have TODO_verify_il set on it.
(execute_one_pass): Don't call clear_last_verified on all functions.
Assert that none of the todos have TODO_verify_il set on it.
* tree-inline.cc (initialize_cfun): Don't copy last_verified.
* tree-pass.h (TODO_verify_all): Remove.
* tree-vrp.cc (pass_data_early_vrp): Remove TODO_verify_all.
(pass_data_fast_vrp): Likewise.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/function.h
gcc/gimple-harden-conditionals.cc
gcc/gimple-harden-control-flow.cc
gcc/ipa-strub.cc
gcc/passes.cc
gcc/tree-inline.cc
gcc/tree-pass.h
gcc/tree-vrp.cc

index 2260d6704ecc4aa5ac9ccac299d91ba716420a07..370629f4de2c67585e024fc5cd84082d0793f9d5 100644 (file)
@@ -333,7 +333,6 @@ struct GTY(()) function {
 
   /* Properties used by the pass manager.  */
   unsigned int curr_properties;
-  unsigned int last_verified;
 
   /* Different from normal TODO_flags which are handled right at the
      beginning or the end of one pass execution, the pending_TODOs
index 3ad3bb98edd76bdf348a9ad60202db9cefdfe27c..d4a418d481a784d70f59fd9c6937d625c98065de 100644 (file)
@@ -61,8 +61,7 @@ const pass_data pass_data_harden_compares = {
   0,       // properties_destroyed
   0,       // properties_start
   TODO_update_ssa
-  | TODO_cleanup_cfg
-  | TODO_verify_il, // properties_finish
+  | TODO_cleanup_cfg, // properties_finish
 };
 
 class pass_harden_compares : public gimple_opt_pass
@@ -96,8 +95,7 @@ const pass_data pass_data_harden_conditional_branches = {
   0,       // properties_destroyed
   0,       // properties_start
   TODO_update_ssa
-  | TODO_cleanup_cfg
-  | TODO_verify_il, // properties_finish
+  | TODO_cleanup_cfg, // properties_finish
 };
 
 class pass_harden_conditional_branches : public gimple_opt_pass
index e46acafbae44ec3b5e26b24e8927f76babad6625..f129ff1e077561bc7a8dc0194ac30cab0ad0e827 100644 (file)
@@ -1549,8 +1549,7 @@ pass_harden_control_flow_redundancy::execute (function *fun)
 
   return
     TODO_update_ssa
-    | TODO_cleanup_cfg
-    | TODO_verify_il;
+    | TODO_cleanup_cfg;
 }
 
 /* Instantiate a hardcfr pass.  */
index 99cc9d930d86dce2946f0fcbb37c151a4dee95c9..d7c0a928600265ad8b7382b085c7d9b8ec095494 100644 (file)
@@ -1770,8 +1770,7 @@ const pass_data pass_data_ipa_strub = {
   0,       // properties_start
   TODO_update_ssa
   | TODO_cleanup_cfg
-  | TODO_rebuild_cgraph_edges
-  | TODO_verify_il, // properties_finish
+  | TODO_rebuild_cgraph_edges, // properties_finish
 };
 
 class pass_ipa_strub : public simple_ipa_opt_pass
index e86aa1f2d1bdd830e815292d823dc558d3992742..6c67ffe56ba9331ebb02fe16ded5fb1c8e7dceb2 100644 (file)
@@ -64,6 +64,9 @@ along with GCC; see the file COPYING3.  If not see
 #include "stringpool.h"
 #include "attribs.h"
 
+/* Reserved TODOs */
+#define TODO_verify_il                 (1u << 31)
+
 using namespace gcc;
 
 /* This is used for debugging.  It allows the current pass to printed
@@ -2059,7 +2062,6 @@ execute_function_todo (function *fn, void *data)
 {
   bool from_ipa_pass = (cfun == NULL);
   unsigned int flags = (size_t)data;
-  flags &= ~fn->last_verified;
   if (!flags)
     return;
 
@@ -2127,8 +2129,6 @@ execute_function_todo (function *fn, void *data)
       gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == pre_verify_pstate);
     }
 
-  fn->last_verified = flags & TODO_verify_all;
-
   pop_cfun ();
 
   /* For IPA passes make sure to release dominator info, it can be
@@ -2193,14 +2193,6 @@ verify_interpass_invariants (void)
   gcc_checking_assert (!fold_deferring_overflow_warnings_p ());
 }
 
-/* Clear the last verified flag.  */
-
-static void
-clear_last_verified (function *fn, void *data ATTRIBUTE_UNUSED)
-{
-  fn->last_verified = 0;
-}
-
 /* Helper function. Verify that the properties has been turn into the
    properties expected by the pass.  */
 
@@ -2339,13 +2331,15 @@ execute_one_ipa_transform_pass (struct cgraph_node *node,
   if (pass->tv_id != TV_NONE)
     timevar_push (pass->tv_id);
 
+  gcc_checking_assert (!(ipa_pass->function_transform_todo_flags_start & TODO_verify_il));
   /* Run pre-pass verification.  */
   execute_todo (ipa_pass->function_transform_todo_flags_start);
 
   /* Do it!  */
   todo_after = ipa_pass->function_transform (node);
 
-  /* Run post-pass cleanup and verification.  */
+  /* Run post-pass cleanup.  */
+  gcc_checking_assert (!(todo_after & TODO_verify_il));
   execute_todo (todo_after);
   verify_interpass_invariants ();
 
@@ -2649,6 +2643,7 @@ execute_one_pass (opt_pass *pass)
 
 
   /* Run pre-pass verification.  */
+  gcc_checking_assert (!(pass->todo_flags_start & TODO_verify_il));
   execute_todo (pass->todo_flags_start);
 
   if (flag_checking)
@@ -2697,11 +2692,11 @@ execute_one_pass (opt_pass *pass)
       return true;
     }
 
-  do_per_function (clear_last_verified, NULL);
-
   do_per_function (update_properties_after_pass, pass);
 
   /* Run post-pass cleanup and verification.  */
+  gcc_checking_assert (!(todo_after & TODO_verify_il));
+  gcc_checking_assert (!(pass->todo_flags_finish & TODO_verify_il));
   execute_todo (todo_after | pass->todo_flags_finish | TODO_verify_il);
   if (profile_report)
     {
index 3289b4f6d0509416c5f383a095f2213f4bf4a25b..1a72e31b06cdd6f3ee9058d5f4092351596cb739 100644 (file)
@@ -2866,7 +2866,6 @@ initialize_cfun (tree new_fndecl, tree callee_fndecl, profile_count count)
   cfun->nonlocal_goto_save_area = src_cfun->nonlocal_goto_save_area;
   cfun->function_end_locus = src_cfun->function_end_locus;
   cfun->curr_properties = src_cfun->curr_properties;
-  cfun->last_verified = src_cfun->last_verified;
   cfun->va_list_gpr_size = src_cfun->va_list_gpr_size;
   cfun->va_list_fpr_size = src_cfun->va_list_fpr_size;
   cfun->has_nonlocal_label = src_cfun->has_nonlocal_label;
index 7cb5a128899af5638d73da3c5de87d4003b162c1..4139f6d8eace831a6bd612164f6eda24ae5a99ea 100644 (file)
@@ -236,9 +236,9 @@ protected:
   (PROP_gimple_any | PROP_gimple_lcf | PROP_gimple_leh | PROP_gimple_lomp)
 
 /* To-do flags.  */
+/* Note (1ul << 31) is reserved for TODO_verify_il. */
 #define TODO_do_not_ggc_collect                (1 << 1)
 #define TODO_cleanup_cfg               (1 << 5)
-#define TODO_verify_il                 (1 << 6)
 #define TODO_dump_symtab               (1 << 7)
 #define TODO_remove_functions          (1 << 8)
 
@@ -308,6 +308,8 @@ protected:
    and stop pass manager.  */
 #define TODO_discard_function          (1 << 23)
 
+/* (1ul << 31) is reserved for TODO_verify_il. */
+
 /* Internally used in execute_function_todo().  */
 #define TODO_update_ssa_any            \
     (TODO_update_ssa                   \
@@ -315,8 +317,6 @@ protected:
      | TODO_update_ssa_full_phi                \
      | TODO_update_ssa_only_virtuals)
 
-#define TODO_verify_all TODO_verify_il
-
 /* To-do flags for pending_TODOs.  */
 
 /* Tell the next scalar cleanup pass that there is
index 5aeb1e066cf98324a7d3363798ea9054da196e4e..cad1a24ab339a45819ed77708844686fa6b3bcb2 100644 (file)
@@ -1297,7 +1297,7 @@ const pass_data pass_data_early_vrp =
   0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_update_ssa | TODO_verify_all ),
+  ( TODO_cleanup_cfg | TODO_update_ssa ),
 };
 
 const pass_data pass_data_fast_vrp =
@@ -1310,7 +1310,7 @@ const pass_data pass_data_fast_vrp =
   0, /* properties_provided */
   0, /* properties_destroyed */
   0, /* todo_flags_start */
-  ( TODO_cleanup_cfg | TODO_update_ssa | TODO_verify_all ),
+  ( TODO_cleanup_cfg | TODO_update_ssa ),
 };