public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.
@ 2014-12-22 10:12 Martin Liška
  2014-12-22 11:17 ` Martin Liška
  2014-12-22 15:47 ` Jan Hubicka
  0 siblings, 2 replies; 3+ messages in thread
From: Martin Liška @ 2014-12-22 10:12 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 191 bytes --]

Hello.

Following IPA ICF patch restricts thunk creation for static-chain thunks.
Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.

Ready for thunk?
Thanks,
Martin

[-- Attachment #2: 0001-IPA-ICF-Fix-for-PR-ipa-63851-and-ipa-63852.patch --]
[-- Type: text/x-patch, Size: 1001 bytes --]

From b247009735cd294b3fd8b727905cb47b5cdaeb51 Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Mon, 22 Dec 2014 10:46:41 +0100
Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

gcc/ChangeLog:

2014-12-22  Martin Liska  <mliska@suse.cz>

	PR ipa/63851
	PR ipa/63852
	* ipa-icf.c (sem_function::merge): Ignore merge operation
	for a thunk created from static chain.
---
 gcc/ipa-icf.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 6cdc21b..b8ef6e0 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
 	  return 0;
 	}
 
+      if (DECL_STATIC_CHAIN (alias->decl))
+        {
+         if (dump_file)
+           fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n");
+
+         return 0;
+        }
+
       alias->icf_merged = true;
       ipa_merge_profiles (local_original, alias);
       alias->create_wrapper (local_original);
-- 
2.1.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.
  2014-12-22 10:12 [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852 Martin Liška
@ 2014-12-22 11:17 ` Martin Liška
  2014-12-22 15:47 ` Jan Hubicka
  1 sibling, 0 replies; 3+ messages in thread
From: Martin Liška @ 2014-12-22 11:17 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 343 bytes --]

On 12/22/2014 10:53 AM, Martin Liška wrote:
> Hello.
>
> Following IPA ICF patch restricts thunk creation for static-chain thunks.
> Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.
>
> Ready for thunk?
> Thanks,
> Martin

In previous mail, I forgot to add one obvious hunk that is quite obvious.

Thanks,
Martin

[-- Attachment #2: 0001-IPA-ICF-Fix-for-PR-ipa-63851-and-ipa-63852.patch --]
[-- Type: text/x-patch, Size: 1683 bytes --]

From a32fceb4af65a21b3b3d48cd3d981bcbe6faa8ab Mon Sep 17 00:00:00 2001
From: mliska <mliska@suse.cz>
Date: Mon, 22 Dec 2014 10:46:41 +0100
Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.

gcc/ChangeLog:

2014-12-22  Martin Liska  <mliska@suse.cz>

	PR ipa/63851
	PR ipa/63852
	* ipa-icf.c (sem_function::merge): Ignore merge operation
	for a thunk created from static chain.
	* ipa-icf-gimple.c (func_checker::compatible_types_p): Verify that
	types have same restrict flag.
---
 gcc/ipa-icf-gimple.c | 3 +++
 gcc/ipa-icf.c        | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c
index fa2c353..6689463 100644
--- a/gcc/ipa-icf-gimple.c
+++ b/gcc/ipa-icf-gimple.c
@@ -185,6 +185,9 @@ bool func_checker::compatible_types_p (tree t1, tree t2,
   if (TREE_CODE (t1) != TREE_CODE (t2))
     return return_false_with_msg ("different tree types");
 
+  if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2))
+    return return_false_with_msg ("restrict flags are different");
+
   if (!types_compatible_p (t1, t2))
     return return_false_with_msg ("types are not compatible");
 
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index 6cdc21b..b8ef6e0 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
 	  return 0;
 	}
 
+      if (DECL_STATIC_CHAIN (alias->decl))
+        {
+         if (dump_file)
+           fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n");
+
+         return 0;
+        }
+
       alias->icf_merged = true;
       ipa_merge_profiles (local_original, alias);
       alias->create_wrapper (local_original);
-- 
2.1.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.
  2014-12-22 10:12 [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852 Martin Liška
  2014-12-22 11:17 ` Martin Liška
@ 2014-12-22 15:47 ` Jan Hubicka
  1 sibling, 0 replies; 3+ messages in thread
From: Jan Hubicka @ 2014-12-22 15:47 UTC (permalink / raw)
  To: Martin Liška; +Cc: GCC Patches

> Hello.
> 
> Following IPA ICF patch restricts thunk creation for static-chain thunks.
> Patch can bootstrap on x86_64-linux-pc and no new regression has been seen.
> 
> Ready for thunk?
> Thanks,
> Martin

> >From b247009735cd294b3fd8b727905cb47b5cdaeb51 Mon Sep 17 00:00:00 2001
> From: mliska <mliska@suse.cz>
> Date: Mon, 22 Dec 2014 10:46:41 +0100
> Subject: [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852.
> 
> gcc/ChangeLog:
> 
> 2014-12-22  Martin Liska  <mliska@suse.cz>
> 
> 	PR ipa/63851
> 	PR ipa/63852
> 	* ipa-icf.c (sem_function::merge): Ignore merge operation
> 	for a thunk created from static chain.

OK.
Please add also the code to match TARGET_OPTION and OPTIMIZATION nodes
Honza
> ---
>  gcc/ipa-icf.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
> index 6cdc21b..b8ef6e0 100644
> --- a/gcc/ipa-icf.c
> +++ b/gcc/ipa-icf.c
> @@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item)
>  	  return 0;
>  	}
>  
> +      if (DECL_STATIC_CHAIN (alias->decl))
> +        {
> +         if (dump_file)
> +           fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n");
> +
> +         return 0;
> +        }
> +
>        alias->icf_merged = true;
>        ipa_merge_profiles (local_original, alias);
>        alias->create_wrapper (local_original);
> -- 
> 2.1.2
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-12-22 15:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-22 10:12 [PATCH] IPA ICF: Fix for PR ipa/63851 and ipa/63852 Martin Liška
2014-12-22 11:17 ` Martin Liška
2014-12-22 15:47 ` Jan Hubicka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).