From f629b8dd43fc8aa2bf2a38cb75c0d8d499ac6d44 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 5 May 2020 13:09:50 +0200 Subject: 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 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. --- gcc/tree-ssa-structalias.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'gcc/tree-ssa-structalias.c') diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 416a26c..e9fcafd 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); -- cgit v1.1 From dc216b25e8e11544803e2526d8cd83ec3c5b005b Mon Sep 17 00:00:00 2001 From: Erick Ochoa Date: Thu, 7 May 2020 13:19:57 -0400 Subject: Fix minor typos in comments that affected syntax highlighting. * gcc/tree-ssa-struct-alias.c: Fix comments --- gcc/tree-ssa-structalias.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-structalias.c') diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index e9fcafd..b37808c 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -57,11 +57,11 @@ as a consequence. See "Efficient Field-sensitive pointer analysis for C" by "David - J. Pearce and Paul H. J. Kelly and Chris Hankin, at + J. Pearce and Paul H. J. Kelly and Chris Hankin", at http://citeseer.ist.psu.edu/pearce04efficient.html Also see "Ultra-fast Aliasing Analysis using CLA: A Million Lines - of C Code in a Second" by ""Nevin Heintze and Olivier Tardieu" at + of C Code in a Second" by "Nevin Heintze and Olivier Tardieu" at http://citeseer.ist.psu.edu/heintze01ultrafast.html There are three types of real constraint expressions, DEREF, @@ -84,7 +84,7 @@ Each variable for a structure field has 1. "size", that tells the size in bits of that field. - 2. "fullsize, that tells the size in bits of the entire structure. + 2. "fullsize", that tells the size in bits of the entire structure. 3. "offset", that tells the offset in bits from the beginning of the structure to this field. @@ -188,7 +188,7 @@ We probably should compute a per-function unit-ESCAPE solution propagating it simply like the clobber / uses solutions. The - solution can go alongside the non-IPA espaced solution and be + solution can go alongside the non-IPA escaped solution and be used to query which vars escape the unit through a function. This is also required to make the escaped-HEAP trick work in IPA mode. -- cgit v1.1 From 179da09d2e4e91f69e0f9b2a7b4a9b16a9566a01 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 7 May 2020 14:06:02 +0200 Subject: ipa/94947 - avoid using externally_visible_p () externally_visible_p wasn't the correct predicate to use (even if it worked), instead we should use DECL_EXTERNAL || TREE_PUBLIC. 2020-05-07 Richard Biener PR ipa/94947 * tree-ssa-structalias.c (refered_from_nonlocal_fn): Use DECL_EXTERNAL || TREE_PUBLIC instead of externally_visible. (refered_from_nonlocal_var): Likewise. (ipa_pta_execute): Likewise. --- gcc/tree-ssa-structalias.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/tree-ssa-structalias.c') diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index b37808c..44fe52e 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -8085,7 +8085,8 @@ refered_from_nonlocal_fn (struct cgraph_node *node, void *data) { bool *nonlocal_p = (bool *)data; *nonlocal_p |= (node->used_from_other_partition - || node->externally_visible + || DECL_EXTERNAL (node->decl) + || TREE_PUBLIC (node->decl) || node->force_output || lookup_attribute ("noipa", DECL_ATTRIBUTES (node->decl))); return false; @@ -8097,7 +8098,8 @@ 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_p () + || DECL_EXTERNAL (node->decl) + || TREE_PUBLIC (node->decl) || node->force_output); return false; } @@ -8146,7 +8148,8 @@ ipa_pta_execute (void) For local functions we see all callers and thus do not need initial constraints for parameters. */ bool nonlocal_p = (node->used_from_other_partition - || node->externally_visible + || DECL_EXTERNAL (node->decl) + || TREE_PUBLIC (node->decl) || node->force_output || lookup_attribute ("noipa", DECL_ATTRIBUTES (node->decl))); @@ -8187,7 +8190,8 @@ ipa_pta_execute (void) /* For the purpose of IPA PTA unit-local globals are not escape points. */ - bool nonlocal_p = (var->externally_visible_p () + bool nonlocal_p = (DECL_EXTERNAL (var->decl) + || TREE_PUBLIC (var->decl) || var->used_from_other_partition || var->force_output); var->call_for_symbol_and_aliases (refered_from_nonlocal_var, -- cgit v1.1