]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
aarch64: Fix PCH for sve builtins [PR123457]
authorAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Thu, 8 Jan 2026 04:28:12 +0000 (20:28 -0800)
committerAndrew Pinski <andrew.pinski@oss.qualcomm.com>
Fri, 9 Jan 2026 20:15:17 +0000 (12:15 -0800)
The problem here is function_table was not in the GGC memory space and not
streamed out. So even though the builtins were reloaded, function_table was
a nullptr as it was not reloaded.

Also noticed initial_indexes should be marked with GTY so it is reloaded correctly
from PCH.

Built and tested for aarch64-linux-gnu.

PR target/123457
gcc/ChangeLog:

* config/aarch64/aarch64-sve-builtins.cc (struct registered_function_hasher):
Change base class to ggc_ptr_hash.
(initial_indexes): Mark with GTY.
(function_table): Likewise.
(handle_arm_sve_h): Allocate function_table from ggc instead of heap.

Signed-off-by: Andrew Pinski <andrew.pinski@oss.qualcomm.com>
gcc/config/aarch64/aarch64-sve-builtins.cc

index b3ebb754d7672b1fc65eb547e995b8c2a017e7ac..d25e5437ba8285432ce3d30f47a78e69a0fb678d 100644 (file)
@@ -94,7 +94,7 @@ public:
 };
 
 /* Hash traits for registered_function.  */
-struct registered_function_hasher : nofree_ptr_hash <registered_function>
+struct registered_function_hasher : ggc_ptr_hash <registered_function>
 {
   typedef function_instance compare_type;
 
@@ -1045,12 +1045,12 @@ tree acle_svprfop;
 static GTY(()) vec<registered_function *, va_gc> *registered_functions;
 
 /* Stores the starting function index for each pragma handler.  */
-static unsigned int initial_indexes[NUM_PRAGMA_HANDLERS];
+static  GTY(()) unsigned int initial_indexes[NUM_PRAGMA_HANDLERS];
 
 /* All registered function decls, hashed on the function_instance
    that they implement.  This is used for looking up implementations of
    overloaded functions.  */
-static hash_table<registered_function_hasher> *function_table;
+static GTY(()) hash_table<registered_function_hasher> *function_table;
 
 /* Index 0 maps all overloaded function names that we've registered so far to
    their associated function_instances.  Index 1 does the same for functions
@@ -4903,7 +4903,7 @@ handle_arm_sve_h (bool function_nulls_p)
   register_svprfop ();
 
   /* Define the functions.  */
-  function_table = new hash_table<registered_function_hasher> (1023);
+  function_table = hash_table<registered_function_hasher>::create_ggc (1023);
   function_builder builder (arm_sve_handle, function_nulls_p);
   for (unsigned int i = 0; i < ARRAY_SIZE (function_groups); ++i)
     builder.register_function_group (function_groups[i]);