]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Remove unnecessary `record` argument from maybe_version_functions.
authorAlfie Richards <alfie.richards@arm.com>
Tue, 28 Jan 2025 15:42:49 +0000 (15:42 +0000)
committerAlfie Richards <alfie.richards@arm.com>
Wed, 16 Jul 2025 09:04:31 +0000 (09:04 +0000)
Previously, the `record` argument in maybe_version_function allowed the
call to cgraph_node::record_function_versions to be skipped.  However,
this was only skipped when both decls were already marked as versioned,
in which case we trigger the early exit in record_function_versions
instead. Therefore, the argument is unnecessary.

gcc/cp/ChangeLog:

* class.cc (add_method): Remove argument.
* cp-tree.h (maybe_version_functions): Ditto.
* decl.cc (decls_match): Ditto.
(maybe_version_functions): Ditto.

gcc/cp/class.cc
gcc/cp/cp-tree.h
gcc/cp/decl.cc

index 151ee2bc4714b3996150c28f29a941819e7eb5a4..f5d20e5c53922b2d16c9e579c7448c21c607b1a9 100644 (file)
@@ -1407,7 +1407,7 @@ add_method (tree type, tree method, bool via_using)
       /* If these are versions of the same function, process and
         move on.  */
       if (TREE_CODE (fn) == FUNCTION_DECL
-         && maybe_version_functions (method, fn, true))
+         && maybe_version_functions (method, fn))
        continue;
 
       if (DECL_INHERITED_CTOR (method))
index 5708aa13a48c98475d26729dccace6a989ce4eab..681025015690164dcabc84759a936cc25a35ed5d 100644 (file)
@@ -7232,7 +7232,7 @@ extern void determine_local_discriminator (tree, tree = NULL_TREE);
 extern bool member_like_constrained_friend_p   (tree);
 extern bool fns_correspond                     (tree, tree);
 extern int decls_match                         (tree, tree, bool = true);
-extern bool maybe_version_functions            (tree, tree, bool);
+extern bool maybe_version_functions            (tree, tree);
 extern bool validate_constexpr_redeclaration   (tree, tree);
 extern bool merge_default_template_args                (tree, tree, bool);
 extern tree duplicate_decls                    (tree, tree,
index 4752874fc97aafa54bdf940933011d9b1d7bbfaf..0ac92f84b0e9299b4d8a6b9f660f1b521882a90b 100644 (file)
@@ -1214,9 +1214,7 @@ decls_match (tree newdecl, tree olddecl, bool record_versions /* = true */)
          && targetm.target_option.function_versions (newdecl, olddecl))
        {
          if (record_versions)
-           maybe_version_functions (newdecl, olddecl,
-                                    (!DECL_FUNCTION_VERSIONED (newdecl)
-                                     || !DECL_FUNCTION_VERSIONED (olddecl)));
+           maybe_version_functions (newdecl, olddecl);
          return 0;
        }
     }
@@ -1283,11 +1281,11 @@ maybe_mark_function_versioned (tree decl)
 }
 
 /* NEWDECL and OLDDECL have identical signatures.  If they are
-   different versions adjust them and return true.
-   If RECORD is set to true, record function versions.  */
+   different versions adjust them, record function versions, and return
+   true.  */
 
 bool
-maybe_version_functions (tree newdecl, tree olddecl, bool record)
+maybe_version_functions (tree newdecl, tree olddecl)
 {
   if (!targetm.target_option.function_versions (newdecl, olddecl))
     return false;
@@ -1310,16 +1308,13 @@ maybe_version_functions (tree newdecl, tree olddecl, bool record)
       maybe_mark_function_versioned (newdecl);
     }
 
-  if (record)
-    {
-      /* Add the new version to the function version structure.  */
-      cgraph_node *fn_node = cgraph_node::get_create (olddecl);
-      cgraph_function_version_info *fn_v = fn_node->function_version ();
-      if (!fn_v)
-       fn_v = fn_node->insert_new_function_version ();
+  /* Add the new version to the function version structure.  */
+  cgraph_node *fn_node = cgraph_node::get_create (olddecl);
+  cgraph_function_version_info *fn_v = fn_node->function_version ();
+  if (!fn_v)
+    fn_v = fn_node->insert_new_function_version ();
 
-      cgraph_node::add_function_version (fn_v, newdecl);
-    }
+  cgraph_node::add_function_version (fn_v, newdecl);
 
   return true;
 }