Commit 67d00c43 by Richard Biener

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.
parent ff9d4e09
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> 2020-05-12 David Edelsohn <dje.gcc@gmail.com>
Backport from mainline Backport from mainline
......
...@@ -3,6 +3,15 @@ ...@@ -3,6 +3,15 @@
Backport from mainline Backport from mainline
2020-05-05 Richard Biener <rguenther@suse.de> 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
2020-05-05 Richard Biener <rguenther@suse.de>
PR testsuite/92177 PR testsuite/92177
* gcc.dg/vect/bb-slp-22.c: Adjust. * gcc.dg/vect/bb-slp-22.c: Adjust.
......
/* { 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;
}
/* { dg-do compile } */
void (*baz_call)();
void baz ()
{
baz_call ();
}
...@@ -8097,7 +8097,7 @@ refered_from_nonlocal_var (struct varpool_node *node, void *data) ...@@ -8097,7 +8097,7 @@ refered_from_nonlocal_var (struct varpool_node *node, void *data)
{ {
bool *nonlocal_p = (bool *)data; bool *nonlocal_p = (bool *)data;
*nonlocal_p |= (node->used_from_other_partition *nonlocal_p |= (node->used_from_other_partition
|| node->externally_visible || node->externally_visible_p ()
|| node->force_output); || node->force_output);
return false; return false;
} }
...@@ -8187,8 +8187,8 @@ ipa_pta_execute (void) ...@@ -8187,8 +8187,8 @@ ipa_pta_execute (void)
/* For the purpose of IPA PTA unit-local globals are not /* For the purpose of IPA PTA unit-local globals are not
escape points. */ escape points. */
bool nonlocal_p = (var->used_from_other_partition bool nonlocal_p = (var->externally_visible_p ()
|| var->externally_visible || var->used_from_other_partition
|| var->force_output); || var->force_output);
var->call_for_symbol_and_aliases (refered_from_nonlocal_var, var->call_for_symbol_and_aliases (refered_from_nonlocal_var,
&nonlocal_p, true); &nonlocal_p, true);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment