diff mbox series

[2/N] IPA summaries use ::get in ipa-pure-const.c.

Message ID e40360cd-4d7d-19c4-3212-7995d36a8141@suse.cz
State New
Headers show
Series [2/N] IPA summaries use ::get in ipa-pure-const.c. | expand

Commit Message

Martin Liška June 20, 2018, 12:04 p.m. UTC
Hi.

This is second part of IPA summaries clean-up. It removes some not needed
::get_create in ipa-pure.const.c.

Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.

Ready to be installed?
Martin

Comments

Jan Hubicka June 20, 2018, 1:40 p.m. UTC | #1
> Hi.
> 
> This is second part of IPA summaries clean-up. It removes some not needed
> ::get_create in ipa-pure.const.c.
> 
> Patch can bootstrap on ppc64le-redhat-linux and survives regression tests.
> 
> Ready to be installed?
OK, thanks!

Honza
> Martin

> From 932bcf9d0247189700edf86e2b07301ba1fa1f87 Mon Sep 17 00:00:00 2001
> From: marxin <mliska@suse.cz>
> Date: Wed, 20 Jun 2018 09:47:54 +0200
> Subject: [PATCH] IPA summaries use ::get in ipa-pure-const.c.
> 
> gcc/ChangeLog:
> 
> 2018-06-20  Martin Liska  <mliska@suse.cz>
> 
> 	* ipa-pure-const.c (propagate_nothrow): Use
>         funct_state_summaries->get.
> 	(dump_malloc_lattice): Likewise.
> 	(propagate_malloc): Likewise.
> ---
>  gcc/ipa-pure-const.c | 13 +++++++------
>  1 file changed, 7 insertions(+), 6 deletions(-)
> 
> diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
> index 4de609e7ca1..714239f8734 100644
> --- a/gcc/ipa-pure-const.c
> +++ b/gcc/ipa-pure-const.c
> @@ -1803,7 +1803,7 @@ propagate_nothrow (void)
>        w = node;
>        while (w)
>  	{
> -	  funct_state w_l = funct_state_summaries->get_create (w);
> +	  funct_state w_l = funct_state_summaries->get (w);
>  	  if (!can_throw && !TREE_NOTHROW (w->decl))
>  	    {
>  	      /* Inline clones share declaration with their offline copies;
> @@ -1841,9 +1841,10 @@ dump_malloc_lattice (FILE *dump_file, const char *s)
>    cgraph_node *node;
>    FOR_EACH_FUNCTION (node)
>      {
> -      funct_state fs = funct_state_summaries->get_create (node);
> -      malloc_state_e state = fs->malloc_state;
> -      fprintf (dump_file, "%s: %s\n", node->name (), malloc_state_names[state]);
> +      funct_state fs = funct_state_summaries->get (node);
> +      if (fs)
> +	fprintf (dump_file, "%s: %s\n", node->name (),
> +		 malloc_state_names[fs->malloc_state]);
>      }
>  }
>  
> @@ -1881,7 +1882,7 @@ propagate_malloc (void)
>  	      || !funct_state_summaries->exists (node))
>  	    continue;
>  
> -	  funct_state l = funct_state_summaries->get_create (node);
> +	  funct_state l = funct_state_summaries->get (node);
>  
>  	  /* FIXME: add support for indirect-calls.  */
>  	  if (node->indirect_calls)
> @@ -1932,7 +1933,7 @@ propagate_malloc (void)
>    FOR_EACH_DEFINED_FUNCTION (node)
>      if (funct_state_summaries->exists (node))
>        {
> -	funct_state l = funct_state_summaries->get_create (node);
> +	funct_state l = funct_state_summaries->get (node);
>  	if (!node->alias
>  	    && l->malloc_state == STATE_MALLOC
>  	    && !node->global.inlined_to)
> -- 
> 2.17.1
>
Eric Botcazou June 23, 2018, 8:13 p.m. UTC | #2
> This is second part of IPA summaries clean-up. It removes some not needed
> 
> ::get_create in ipa-pure.const.c.

It breaks the attached testcase compiled with "gnatmake lto_full -f -a -flto":

gnatbind -x lto_full.ali
gnatlink lto_full.ali -flto
during IPA pass: pure-const
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Martin Liška June 28, 2018, 7:59 a.m. UTC | #3
On 06/23/2018 10:13 PM, Eric Botcazou wrote:
>> This is second part of IPA summaries clean-up. It removes some not needed
>>
>> ::get_create in ipa-pure.const.c.
> 
> It breaks the attached testcase compiled with "gnatmake lto_full -f -a -flto":
> 
> gnatbind -x lto_full.ali
> gnatlink lto_full.ali -flto
> during IPA pass: pure-const
> lto1: internal compiler error: Segmentation fault
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <https://gcc.gnu.org/bugs/> for instructions.
> 

Hi.

Sorry for the breakage, according to back-track, it's very similar to:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86279

I'll fix that as well.

Martin
diff mbox series

Patch

From 932bcf9d0247189700edf86e2b07301ba1fa1f87 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 20 Jun 2018 09:47:54 +0200
Subject: [PATCH] IPA summaries use ::get in ipa-pure-const.c.

gcc/ChangeLog:

2018-06-20  Martin Liska  <mliska@suse.cz>

	* ipa-pure-const.c (propagate_nothrow): Use
        funct_state_summaries->get.
	(dump_malloc_lattice): Likewise.
	(propagate_malloc): Likewise.
---
 gcc/ipa-pure-const.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/gcc/ipa-pure-const.c b/gcc/ipa-pure-const.c
index 4de609e7ca1..714239f8734 100644
--- a/gcc/ipa-pure-const.c
+++ b/gcc/ipa-pure-const.c
@@ -1803,7 +1803,7 @@  propagate_nothrow (void)
       w = node;
       while (w)
 	{
-	  funct_state w_l = funct_state_summaries->get_create (w);
+	  funct_state w_l = funct_state_summaries->get (w);
 	  if (!can_throw && !TREE_NOTHROW (w->decl))
 	    {
 	      /* Inline clones share declaration with their offline copies;
@@ -1841,9 +1841,10 @@  dump_malloc_lattice (FILE *dump_file, const char *s)
   cgraph_node *node;
   FOR_EACH_FUNCTION (node)
     {
-      funct_state fs = funct_state_summaries->get_create (node);
-      malloc_state_e state = fs->malloc_state;
-      fprintf (dump_file, "%s: %s\n", node->name (), malloc_state_names[state]);
+      funct_state fs = funct_state_summaries->get (node);
+      if (fs)
+	fprintf (dump_file, "%s: %s\n", node->name (),
+		 malloc_state_names[fs->malloc_state]);
     }
 }
 
@@ -1881,7 +1882,7 @@  propagate_malloc (void)
 	      || !funct_state_summaries->exists (node))
 	    continue;
 
-	  funct_state l = funct_state_summaries->get_create (node);
+	  funct_state l = funct_state_summaries->get (node);
 
 	  /* FIXME: add support for indirect-calls.  */
 	  if (node->indirect_calls)
@@ -1932,7 +1933,7 @@  propagate_malloc (void)
   FOR_EACH_DEFINED_FUNCTION (node)
     if (funct_state_summaries->exists (node))
       {
-	funct_state l = funct_state_summaries->get_create (node);
+	funct_state l = funct_state_summaries->get (node);
 	if (!node->alias
 	    && l->malloc_state == STATE_MALLOC
 	    && !node->global.inlined_to)
-- 
2.17.1