ipa: Initialize/release global obstack in process_new_functions [PR116068]

Message ID Z4duDCaPDogO8ibQ@tucnak
State New
Headers
Series ipa: Initialize/release global obstack in process_new_functions [PR116068] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply

Commit Message

Jakub Jelinek Jan. 15, 2025, 8:13 a.m. UTC
  Hi!

Other spots in cgraphunit.cc already call bitmap_obstack_initialize (NULL);
before running a pass list and bitmap_obstack_release (NULL); after that,
while process_new_functions wasn't doing that and with the new r15-130
bitmap_alloc checking that results in ICE.

Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
trunk?

2025-01-15  Jakub Jelinek  <jakub@redhat.com>

	PR ipa/116068
	* cgraphunit.cc (symbol_table::process_new_functions): Call
	bitmap_obstack_initialize (NULL); and bitmap_obstack_release (NULL)
	around processing the functions.

	* gcc.dg/graphite/pr116068.c: New test.


	Jakub
  

Comments

Jan Hubicka Jan. 15, 2025, 8:25 a.m. UTC | #1
> Hi!
> 
> Other spots in cgraphunit.cc already call bitmap_obstack_initialize (NULL);
> before running a pass list and bitmap_obstack_release (NULL); after that,
> while process_new_functions wasn't doing that and with the new r15-130
> bitmap_alloc checking that results in ICE.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK. Maybe we want to backport this too?

Honza
  
Richard Biener Jan. 15, 2025, 9 a.m. UTC | #2
On Wed, 15 Jan 2025, Jakub Jelinek wrote:

> Hi!
> 
> Other spots in cgraphunit.cc already call bitmap_obstack_initialize (NULL);
> before running a pass list and bitmap_obstack_release (NULL); after that,
> while process_new_functions wasn't doing that and with the new r15-130
> bitmap_alloc checking that results in ICE.
> 
> Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for
> trunk?

OK (also for backports).

Thanks,
Richard.

> 2025-01-15  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR ipa/116068
> 	* cgraphunit.cc (symbol_table::process_new_functions): Call
> 	bitmap_obstack_initialize (NULL); and bitmap_obstack_release (NULL)
> 	around processing the functions.
> 
> 	* gcc.dg/graphite/pr116068.c: New test.
> 
> --- gcc/cgraphunit.cc.jj	2025-01-02 20:54:31.745135236 +0100
> +++ gcc/cgraphunit.cc	2025-01-14 14:31:14.016349672 +0100
> @@ -311,6 +311,7 @@ symbol_table::process_new_functions (voi
>      {
>        cgraph_node *node = cgraph_new_nodes[i];
>        fndecl = node->decl;
> +      bitmap_obstack_initialize (NULL);
>        switch (state)
>  	{
>  	case CONSTRUCTION:
> @@ -367,6 +368,7 @@ symbol_table::process_new_functions (voi
>  	  gcc_unreachable ();
>  	  break;
>  	}
> +      bitmap_obstack_release (NULL);
>      }
>  
>    cgraph_new_nodes.release ();
> --- gcc/testsuite/gcc.dg/graphite/pr116068.c.jj	2025-01-14 14:26:34.184285576 +0100
> +++ gcc/testsuite/gcc.dg/graphite/pr116068.c	2025-01-14 14:30:41.161811787 +0100
> @@ -0,0 +1,26 @@
> +/* PR ipa/116068 */
> +/* { dg-do compile { target { lto && { bitint && int128 } } } } */
> +/* { dg-options "-Os -flto -ffat-lto-objects -floop-parallelize-all -ftree-parallelize-loops=2 --param=parloops-schedule=dynamic" } */
> +
> +#if __BITINT_MAXWIDTH__ >= 1024
> +typedef _BitInt (1024) A;
> +typedef __attribute__((__vector_size__ (16))) char B;
> +typedef __attribute__((__vector_size__ (16))) int C;
> +B a;
> +A b;
> +int c;
> +unsigned int *p;
> +
> +void
> +foo0 (unsigned _BitInt (512) x)
> +{
> +  C d = {};
> +  _BitInt (1024) e = x | *(A *) __builtin_memset (&b, c, 8);
> +  unsigned h = __builtin_stdc_first_leading_zero (*p);
> +  C f = *(C *) __builtin_memset (&d, h, 6);
> +  B g = (B) f;
> +  a = g + (B) (__int128) e;
> +}
> +#else
> +int i;
> +#endif
> 
> 	Jakub
> 
>
  

Patch

--- gcc/cgraphunit.cc.jj	2025-01-02 20:54:31.745135236 +0100
+++ gcc/cgraphunit.cc	2025-01-14 14:31:14.016349672 +0100
@@ -311,6 +311,7 @@  symbol_table::process_new_functions (voi
     {
       cgraph_node *node = cgraph_new_nodes[i];
       fndecl = node->decl;
+      bitmap_obstack_initialize (NULL);
       switch (state)
 	{
 	case CONSTRUCTION:
@@ -367,6 +368,7 @@  symbol_table::process_new_functions (voi
 	  gcc_unreachable ();
 	  break;
 	}
+      bitmap_obstack_release (NULL);
     }
 
   cgraph_new_nodes.release ();
--- gcc/testsuite/gcc.dg/graphite/pr116068.c.jj	2025-01-14 14:26:34.184285576 +0100
+++ gcc/testsuite/gcc.dg/graphite/pr116068.c	2025-01-14 14:30:41.161811787 +0100
@@ -0,0 +1,26 @@ 
+/* PR ipa/116068 */
+/* { dg-do compile { target { lto && { bitint && int128 } } } } */
+/* { dg-options "-Os -flto -ffat-lto-objects -floop-parallelize-all -ftree-parallelize-loops=2 --param=parloops-schedule=dynamic" } */
+
+#if __BITINT_MAXWIDTH__ >= 1024
+typedef _BitInt (1024) A;
+typedef __attribute__((__vector_size__ (16))) char B;
+typedef __attribute__((__vector_size__ (16))) int C;
+B a;
+A b;
+int c;
+unsigned int *p;
+
+void
+foo0 (unsigned _BitInt (512) x)
+{
+  C d = {};
+  _BitInt (1024) e = x | *(A *) __builtin_memset (&b, c, 8);
+  unsigned h = __builtin_stdc_first_leading_zero (*p);
+  C f = *(C *) __builtin_memset (&d, h, 6);
+  B g = (B) f;
+  a = g + (B) (__int128) e;
+}
+#else
+int i;
+#endif