public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] ipa/97565 - fix IPA PTA body availability check
@ 2021-08-23 14:01 Richard Biener
  2021-08-23 14:04 ` Jan Hubicka
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Biener @ 2021-08-23 14:01 UTC (permalink / raw)
  To: gcc-patches; +Cc: hubicka

Looks like the existing check using has_gimple_body_p isn't enough
at LTRANS time but I need to check in_other_partition as well.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

OK?

Thanks,
Richard.

2021-08-23  Richard Biener  <rguenther@suse.de>

	PR ipa/97565
	* tree-ssa-structalias.c (ipa_pta_execute): Check in_other_partition
	in addition to has_gimple_body.

	* g++.dg/lto/pr97565_0.C: New testcase.
	* g++.dg/lto/pr97565_1.C: Likewise.
---
 gcc/testsuite/g++.dg/lto/pr97565_0.C |  7 +++++++
 gcc/testsuite/g++.dg/lto/pr97565_1.C |  6 ++++++
 gcc/tree-ssa-structalias.c           | 22 ++++++++++++++--------
 3 files changed, 27 insertions(+), 8 deletions(-)
 create mode 100644 gcc/testsuite/g++.dg/lto/pr97565_0.C
 create mode 100644 gcc/testsuite/g++.dg/lto/pr97565_1.C

diff --git a/gcc/testsuite/g++.dg/lto/pr97565_0.C b/gcc/testsuite/g++.dg/lto/pr97565_0.C
new file mode 100644
index 00000000000..f4572e17bf5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr97565_0.C
@@ -0,0 +1,7 @@
+// { dg-lto-do link }
+// { dg-lto-options { "-O -flto -fipa-pta" } }
+
+extern "C" void abort(void)
+{
+  abort();
+}
diff --git a/gcc/testsuite/g++.dg/lto/pr97565_1.C b/gcc/testsuite/g++.dg/lto/pr97565_1.C
new file mode 100644
index 00000000000..ff7b638e9c5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/lto/pr97565_1.C
@@ -0,0 +1,6 @@
+extern "C" void abort(void);
+
+int main(int argc, char * argv[])
+{
+  abort();
+}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index fb0e4299703..c4308551d1b 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -8220,10 +8220,12 @@ ipa_pta_execute (void)
   FOR_EACH_DEFINED_FUNCTION (node)
     {
       varinfo_t vi;
-      /* Nodes without a body are not interesting.  Especially do not
-         visit clones at this point for now - we get duplicate decls
-	 there for inline clones at least.  */
-      if (!node->has_gimple_body_p () || node->inlined_to)
+      /* Nodes without a body in this partition are not interesting.
+	 Especially do not visit clones at this point for now - we
+	 get duplicate decls there for inline clones at least.  */
+      if (!node->has_gimple_body_p ()
+	  || node->in_other_partition
+	  || node->inlined_to)
 	continue;
       node->get_body ();
 
@@ -8301,8 +8303,10 @@ ipa_pta_execute (void)
       struct function *func;
       basic_block bb;
 
-      /* Nodes without a body are not interesting.  */
-      if (!node->has_gimple_body_p () || node->clone_of)
+      /* Nodes without a body in this partition are not interesting.  */
+      if (!node->has_gimple_body_p ()
+	  || node->in_other_partition
+	  || node->clone_of)
 	continue;
 
       if (dump_file)
@@ -8431,8 +8435,10 @@ ipa_pta_execute (void)
       unsigned i;
       basic_block bb;
 
-      /* Nodes without a body are not interesting.  */
-      if (!node->has_gimple_body_p () || node->clone_of)
+      /* Nodes without a body in this partition are not interesting.  */
+      if (!node->has_gimple_body_p ()
+	  || node->in_other_partition
+	  || node->clone_of)
 	continue;
 
       fn = DECL_STRUCT_FUNCTION (node->decl);
-- 
2.31.1

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

* Re: [PATCH] ipa/97565 - fix IPA PTA body availability check
  2021-08-23 14:01 [PATCH] ipa/97565 - fix IPA PTA body availability check Richard Biener
@ 2021-08-23 14:04 ` Jan Hubicka
  0 siblings, 0 replies; 2+ messages in thread
From: Jan Hubicka @ 2021-08-23 14:04 UTC (permalink / raw)
  To: Richard Biener; +Cc: gcc-patches

> Looks like the existing check using has_gimple_body_p isn't enough
> at LTRANS time but I need to check in_other_partition as well.
> 
> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> 
> OK?
> 
> Thanks,
> Richard.
> 
> 2021-08-23  Richard Biener  <rguenther@suse.de>
> 
> 	PR ipa/97565
> 	* tree-ssa-structalias.c (ipa_pta_execute): Check in_other_partition
> 	in addition to has_gimple_body.
> 
> 	* g++.dg/lto/pr97565_0.C: New testcase.
> 	* g++.dg/lto/pr97565_1.C: Likewise.
OK,
thanks!

Honza
> ---
>  gcc/testsuite/g++.dg/lto/pr97565_0.C |  7 +++++++
>  gcc/testsuite/g++.dg/lto/pr97565_1.C |  6 ++++++
>  gcc/tree-ssa-structalias.c           | 22 ++++++++++++++--------
>  3 files changed, 27 insertions(+), 8 deletions(-)
>  create mode 100644 gcc/testsuite/g++.dg/lto/pr97565_0.C
>  create mode 100644 gcc/testsuite/g++.dg/lto/pr97565_1.C
> 
> diff --git a/gcc/testsuite/g++.dg/lto/pr97565_0.C b/gcc/testsuite/g++.dg/lto/pr97565_0.C
> new file mode 100644
> index 00000000000..f4572e17bf5
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/lto/pr97565_0.C
> @@ -0,0 +1,7 @@
> +// { dg-lto-do link }
> +// { dg-lto-options { "-O -flto -fipa-pta" } }
> +
> +extern "C" void abort(void)
> +{
> +  abort();
> +}
> diff --git a/gcc/testsuite/g++.dg/lto/pr97565_1.C b/gcc/testsuite/g++.dg/lto/pr97565_1.C
> new file mode 100644
> index 00000000000..ff7b638e9c5
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/lto/pr97565_1.C
> @@ -0,0 +1,6 @@
> +extern "C" void abort(void);
> +
> +int main(int argc, char * argv[])
> +{
> +  abort();
> +}
> diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
> index fb0e4299703..c4308551d1b 100644
> --- a/gcc/tree-ssa-structalias.c
> +++ b/gcc/tree-ssa-structalias.c
> @@ -8220,10 +8220,12 @@ ipa_pta_execute (void)
>    FOR_EACH_DEFINED_FUNCTION (node)
>      {
>        varinfo_t vi;
> -      /* Nodes without a body are not interesting.  Especially do not
> -         visit clones at this point for now - we get duplicate decls
> -	 there for inline clones at least.  */
> -      if (!node->has_gimple_body_p () || node->inlined_to)
> +      /* Nodes without a body in this partition are not interesting.
> +	 Especially do not visit clones at this point for now - we
> +	 get duplicate decls there for inline clones at least.  */
> +      if (!node->has_gimple_body_p ()
> +	  || node->in_other_partition
> +	  || node->inlined_to)
>  	continue;
>        node->get_body ();
>  
> @@ -8301,8 +8303,10 @@ ipa_pta_execute (void)
>        struct function *func;
>        basic_block bb;
>  
> -      /* Nodes without a body are not interesting.  */
> -      if (!node->has_gimple_body_p () || node->clone_of)
> +      /* Nodes without a body in this partition are not interesting.  */
> +      if (!node->has_gimple_body_p ()
> +	  || node->in_other_partition
> +	  || node->clone_of)
>  	continue;
>  
>        if (dump_file)
> @@ -8431,8 +8435,10 @@ ipa_pta_execute (void)
>        unsigned i;
>        basic_block bb;
>  
> -      /* Nodes without a body are not interesting.  */
> -      if (!node->has_gimple_body_p () || node->clone_of)
> +      /* Nodes without a body in this partition are not interesting.  */
> +      if (!node->has_gimple_body_p ()
> +	  || node->in_other_partition
> +	  || node->clone_of)
>  	continue;
>  
>        fn = DECL_STRUCT_FUNCTION (node->decl);
> -- 
> 2.31.1

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

end of thread, other threads:[~2021-08-23 14:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-23 14:01 [PATCH] ipa/97565 - fix IPA PTA body availability check Richard Biener
2021-08-23 14:04 ` 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).