From: Jan Hubicka <hubicka@ucw.cz>
To: gcc-patches@gcc.gnu.org, rguenther@suse.de, d@dcepelik.cz
Subject: Add early exit to access path oracle
Date: Fri, 05 Jul 2019 09:26:00 -0000 [thread overview]
Message-ID: <20190705091629.4odngxwcwbaqs4mw@kam.mff.cuni.cz> (raw)
Hi,
this patch adds early exit into nonoverlapping_component_refs_since_match_p
so we do not try to parse the access paths when there is obviously nothing to do.
It also improves statistics byt not accounting the early exit as a querry
and also to account cases we found both paths to be matching (so we have kind
of must alias assuming that bases are the same modulo array refs that I plan
to fix soon too).
Bootstrapped/regtested x86_64-linux, comitted.
The stats now look as follows:
Alias oracle query stats:
refs_may_alias_p: 4392494 disambiguations, 4762170 queries
ref_maybe_used_by_call_p: 6790 disambiguations, 4418867 queries
call_may_clobber_ref_p: 883 disambiguations, 883 queries
nonoverlapping_component_refs_p: 0 disambiguations, 33 queries
nonoverlapping_component_refs_since_match_p: 66 disambiguations, 2330 must overlaps, 2586 queries
aliasing_component_refs_p: 932 disambiguations, 30391 queries
TBAA oracle: 1860937 disambiguations 3844917 queries
774883 are in alias set 0
713704 queries asked about the same object
0 queries asked about the same alias set
0 access volatile
356107 are dependent in the DAG
139286 are aritificially in conflict with void *
PTA query stats:
pt_solution_includes: 911807 disambiguations, 1226678 queries
pt_solutions_intersect: 121134 disambiguations, 551599 queries
So we have relatively little work left for nonoverlapping_component_refs_p
and also nonoverlapping_component_refs_since_match_p has overal 256 querries
it may disambiguate because there are different paths, and it suceeds in 66 of them.
Honza
* tree-ssa-alias.c (alias_stats): Add
nonoverlapping_component_refs_since_match_p_must_overlap.
(dump_alias_stats): Print it.
(nonoverlapping_component_refs_since_match_p): Add early exit.
(nonoverlapping_component_refs_p): Do not account early exit.
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c (revision 273130)
+++ tree-ssa-alias.c (working copy)
@@ -105,6 +105,7 @@ static struct {
unsigned HOST_WIDE_INT nonoverlapping_component_refs_p_may_alias;
unsigned HOST_WIDE_INT nonoverlapping_component_refs_p_no_alias;
unsigned HOST_WIDE_INT nonoverlapping_component_refs_since_match_p_may_alias;
+ unsigned HOST_WIDE_INT nonoverlapping_component_refs_since_match_p_must_overlap;
unsigned HOST_WIDE_INT nonoverlapping_component_refs_since_match_p_no_alias;
} alias_stats;
@@ -138,10 +139,13 @@ dump_alias_stats (FILE *s)
+ alias_stats.nonoverlapping_component_refs_p_may_alias);
fprintf (s, " nonoverlapping_component_refs_since_match_p: "
HOST_WIDE_INT_PRINT_DEC" disambiguations, "
+ HOST_WIDE_INT_PRINT_DEC" must overlaps, "
HOST_WIDE_INT_PRINT_DEC" queries\n",
alias_stats.nonoverlapping_component_refs_since_match_p_no_alias,
+ alias_stats.nonoverlapping_component_refs_since_match_p_must_overlap,
alias_stats.nonoverlapping_component_refs_since_match_p_no_alias
- + alias_stats.nonoverlapping_component_refs_since_match_p_may_alias);
+ + alias_stats.nonoverlapping_component_refs_since_match_p_may_alias
+ + alias_stats.nonoverlapping_component_refs_since_match_p_must_overlap);
fprintf (s, " aliasing_component_refs_p: "
HOST_WIDE_INT_PRINT_DEC" disambiguations, "
HOST_WIDE_INT_PRINT_DEC" queries\n",
@@ -1149,6 +1153,17 @@ static int
nonoverlapping_component_refs_since_match_p (tree match1, tree ref1,
tree match2, tree ref2)
{
+ /* Early return if there are no references to match, we do not need
+ to walk the access paths.
+
+ Do not consider this as may-alias for stats - it is more useful
+ to have information how many disambiguations happened provided that
+ the query was meaningful. */
+
+ if (match1 == ref1 || !handled_component_p (ref1)
+ || match2 == ref2 || !handled_component_p (ref2))
+ return -1;
+
auto_vec<tree, 16> component_refs1;
auto_vec<tree, 16> component_refs2;
@@ -1214,7 +1229,7 @@ nonoverlapping_component_refs_since_matc
if (component_refs1.is_empty ())
{
++alias_stats
- .nonoverlapping_component_refs_since_match_p_may_alias;
+ .nonoverlapping_component_refs_since_match_p_must_overlap;
return 0;
}
ref1 = component_refs1.pop ();
@@ -1226,7 +1241,7 @@ nonoverlapping_component_refs_since_matc
if (component_refs2.is_empty ())
{
++alias_stats
- .nonoverlapping_component_refs_since_match_p_may_alias;
+ .nonoverlapping_component_refs_since_match_p_must_overlap;
return 0;
}
ref2 = component_refs2.pop ();
@@ -1266,7 +1281,7 @@ nonoverlapping_component_refs_since_matc
|| DECL_BIT_FIELD_REPRESENTATIVE (field2) == field1)
{
++alias_stats
- .nonoverlapping_component_refs_since_match_p_may_alias;
+ .nonoverlapping_component_refs_since_match_p_must_overlap;
return 0;
}
/* Different fields of the same record type cannot overlap.
@@ -1274,7 +1289,7 @@ nonoverlapping_component_refs_since_matc
if (DECL_BIT_FIELD (field1) && DECL_BIT_FIELD (field2))
{
++alias_stats
- .nonoverlapping_component_refs_since_match_p_may_alias;
+ .nonoverlapping_component_refs_since_match_p_must_overlap;
return 0;
}
++alias_stats.nonoverlapping_component_refs_since_match_p_no_alias;
@@ -1282,7 +1297,7 @@ nonoverlapping_component_refs_since_matc
}
}
- ++alias_stats.nonoverlapping_component_refs_since_match_p_may_alias;
+ ++alias_stats.nonoverlapping_component_refs_since_match_p_must_overlap;
return 0;
}
@@ -1309,14 +1324,16 @@ ncr_compar (const void *field1_, const v
static bool
nonoverlapping_component_refs_p (const_tree x, const_tree y)
{
+ /* Early return if we have nothing to do.
+
+ Do not consider this as may-alias for stats - it is more useful
+ to have information how many disambiguations happened provided that
+ the query was meaningful. */
if (!flag_strict_aliasing
|| !x || !y
|| !handled_component_p (x)
|| !handled_component_p (y))
- {
- ++alias_stats.nonoverlapping_component_refs_p_may_alias;
- return false;
- }
+ return false;
auto_vec<const_tree, 16> fieldsx;
while (handled_component_p (x))
reply other threads:[~2019-07-05 9:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190705091629.4odngxwcwbaqs4mw@kam.mff.cuni.cz \
--to=hubicka@ucw.cz \
--cc=d@dcepelik.cz \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).