[gcc(refs/vendors/ARM/heads/arm-perf-staging)] ipa/94947 - fix test for externally visible variables for IPA PTA
Tamar Christina
tnfchris@gcc.gnu.org
Fri Jul 17 15:12:45 GMT 2020
https://gcc.gnu.org/g:67d00c438285ecf9b8e96c12d1f6b05fd2ea3c21
commit 67d00c438285ecf9b8e96c12d1f6b05fd2ea3c21
Author: Richard Biener <rguenther@suse.de>
Date: Tue May 5 13:09:50 2020 +0200
ipa/94947 - fix test for externally visible variables for IPA PTA
This fixes lack of an escape point of externally declared variables.
2020-05-05 Richard Biener <rguenther@suse.de>
PR ipa/94947
* tree-ssa-structalias.c (ipa_pta_execute): Use
varpool_node::externally_visible_p ().
(refered_from_nonlocal_var): Likewise.
* gcc.dg/torture/pr94947-1.c: New testcase.
* gcc.dg/torture/pr94947-2.c: Likewise.
Diff:
---
gcc/ChangeLog | 10 ++++++++++
gcc/testsuite/ChangeLog | 9 +++++++++
gcc/testsuite/gcc.dg/torture/pr94947-1.c | 23 +++++++++++++++++++++++
gcc/testsuite/gcc.dg/torture/pr94947-2.c | 7 +++++++
gcc/tree-ssa-structalias.c | 6 +++---
5 files changed, 52 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 618f6010302..f6fb1e46fe6 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,13 @@
+2020-05-12 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2020-05-05 Richard Biener <rguenther@suse.de>
+
+ PR ipa/94947
+ * tree-ssa-structalias.c (ipa_pta_execute): Use
+ varpool_node::externally_visible_p ().
+ (refered_from_nonlocal_var): Likewise.
+
2020-05-12 David Edelsohn <dje.gcc@gmail.com>
Backport from mainline
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 5e161a1c2ba..574d8cad160 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2020-05-12 Richard Biener <rguenther@suse.de>
+
+ Backport from mainline
+ 2020-05-05 Richard Biener <rguenther@suse.de>
+
+ PR ipa/94947
+ * gcc.dg/torture/pr94947-1.c: New testcase.
+ * gcc.dg/torture/pr94947-2.c: Likewise.
+
2020-05-12 Richard Biener <rguenther@suse.de>
Backport from mainline
diff --git a/gcc/testsuite/gcc.dg/torture/pr94947-1.c b/gcc/testsuite/gcc.dg/torture/pr94947-1.c
new file mode 100644
index 00000000000..ab8b488c6fc
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr94947-1.c
@@ -0,0 +1,23 @@
+/* { dg-do run } */
+/* { dg-additional-sources "pr94947-2.c" } */
+/* { dg-additional-options "-fipa-pta -flto-partition=1to1" } */
+
+extern void abort ();
+extern void baz ();
+extern void (*baz_call)();
+static int *p;
+
+static void foo ()
+{
+ if (*p != 1)
+ abort ();
+}
+
+int main()
+{
+ int x = 1;
+ p = &x;
+ baz_call = foo;
+ baz ();
+ return 0;
+}
diff --git a/gcc/testsuite/gcc.dg/torture/pr94947-2.c b/gcc/testsuite/gcc.dg/torture/pr94947-2.c
new file mode 100644
index 00000000000..670dd61c1e9
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr94947-2.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+
+void (*baz_call)();
+void baz ()
+{
+ baz_call ();
+}
diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c
index 416a26c996c..e9fcafd9b34 100644
--- a/gcc/tree-ssa-structalias.c
+++ b/gcc/tree-ssa-structalias.c
@@ -8097,7 +8097,7 @@ refered_from_nonlocal_var (struct varpool_node *node, void *data)
{
bool *nonlocal_p = (bool *)data;
*nonlocal_p |= (node->used_from_other_partition
- || node->externally_visible
+ || node->externally_visible_p ()
|| node->force_output);
return false;
}
@@ -8187,8 +8187,8 @@ ipa_pta_execute (void)
/* For the purpose of IPA PTA unit-local globals are not
escape points. */
- bool nonlocal_p = (var->used_from_other_partition
- || var->externally_visible
+ bool nonlocal_p = (var->externally_visible_p ()
+ || var->used_from_other_partition
|| var->force_output);
var->call_for_symbol_and_aliases (refered_from_nonlocal_var,
&nonlocal_p, true);
More information about the Gcc-cvs
mailing list