]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ipa/97565 - fix IPA PTA body availability check
authorRichard Biener <rguenther@suse.de>
Mon, 23 Aug 2021 13:37:48 +0000 (15:37 +0200)
committerRichard Biener <rguenther@suse.de>
Tue, 24 Aug 2021 06:44:41 +0000 (08:44 +0200)
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.

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.

(cherry picked from commit 0230e69a3fabe6ad1d80cdf308ad1bf1934c4381)

gcc/testsuite/g++.dg/lto/pr97565_0.C [new file with mode: 0644]
gcc/testsuite/g++.dg/lto/pr97565_1.C [new file with mode: 0644]
gcc/tree-ssa-structalias.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 (file)
index 0000000..f4572e1
--- /dev/null
@@ -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 (file)
index 0000000..ff7b638
--- /dev/null
@@ -0,0 +1,6 @@
+extern "C" void abort(void);
+
+int main(int argc, char * argv[])
+{
+  abort();
+}
index 529ec3a5b8049c9eb25f7ac9fd4dac1f9fb9a5cc..ba4e78bc9e326f9ae3496ad18d30826a6fa7debf 100644 (file)
@@ -8179,10 +8179,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 ();
 
@@ -8260,8 +8262,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)
@@ -8390,8 +8394,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);